Your concept feed

37 ideas

A few small steps. No rush.

Follow the connections in this topic

Let’s picture it

One integer can hold many booleans.

C:1
B:0
A:1

Bits 101 mean switches A and C are on while B is off.

Swipe when you’re ready
One little change

Each operator asks a different question.

OR set
AND test
XOR toggle
shift

OR turns bits on, AND tests or keeps them, XOR toggles differences, and shifts move bit positions.

Same idea. One more small step.
Now it has a name

Mask before interpreting.

unbounded integer
explicit width

Python integers do not have a fixed signed width. Define width explicitly when simulating 32-bit behavior.

Want to try a tiny question?
No pressure. Just try it.

What does x & (1 << i) test?

You can also keep scrolling
1 / 4
Bits, math & geometry

One small step at a time.

This idea builds on these smaller ones. Pick any to revisit it here.

Give three places their own switches.

C: 0
B: 0
A: 0

Rightmost is A, middle is B, leftmost is C. A lit bit means that place has been visited.

1 / 5
Let’s picture it

Equal values cancel.

x⊕x=0
x⊕0=x

x XOR x is zero, and x XOR 0 is x. Pairing equal values removes them regardless of order.

Swipe when you’re ready
One little change

One unpaired value remains.

4
1
4
→1

In [4,1,4], XORing everything cancels the two 4s and leaves 1.

Same idea. One more small step.
Now it has a name

The guarantee is the algorithm.

pairs cancel
one odd remains

This works because every other value occurs exactly twice. Different multiplicities require different state.

Want to try a tiny question?
No pressure. Just try it.

Would ordinary XOR find one unique value if others appear three times?

You can also keep scrolling
1 / 4
Bits, math & geometry

One small step at a time.

This idea builds on these smaller ones. Pick any to revisit it here.

One integer can hold many booleans.

C:1
B:0
A:1

Bits 101 mean switches A and C are on while B is off.

1 / 3
Let’s picture it

XOR also has prefix cancellation.

prefix before left
range
prefix after right

Let prefix[i] XOR the values before i. A range left..right equals prefix[right+1] XOR prefix[left].

Swipe when you’re ready
One little change

The shared prefix disappears.

shared prefix twice
→0

Everything before left appears twice in that XOR and cancels bit by bit.

Same idea. One more small step.
Now it has a name

Updates make prefixes stale.

static queries
dynamic structure

This is ideal for many queries on frozen data. Online changes need a Fenwick or segment tree using XOR combine.

Want to try a tiny question?
No pressure. Just try it.

Which operation replaces subtraction for XOR prefixes?

You can also keep scrolling
1 / 4
Bits, math & geometry

One small step at a time.

This idea builds on these smaller ones. Pick any to revisit it here.

A window meets a negative number.

2
−1
1

Find stretches totaling 2 in [2, −1, 1]. Adding −1 shrinks the sum, so the usual window direction is no longer reliable.

1 / 5
Let’s picture it

Remainders make numbers smaller.

48
18
remainder 12

gcd(48,18) equals gcd(18,12), because 48 = 2·18 + 12.

Swipe when you’re ready
One little change

Common divisors are preserved.

same common divisors

A number divides both 48 and 18 exactly when it divides 18 and their remainder 12.

Same idea. One more small step.
Now it has a name

Repeat until remainder zero.

18,12
12,6
6,0

gcd(18,12)→gcd(12,6)→gcd(6,0). The remaining nonzero number is the gcd.

Want to try a tiny question?
No pressure. Just try it.

Why may a be replaced by a mod b?

You can also keep scrolling
1 / 4
Bits, math & geometry

One small step at a time.

This idea builds on these smaller ones. Pick any to revisit it here.

Find 8 in a sorted row.

2
4
6
8
10

Start with 2, 4, 6, 8, 10. Look at the middle: 6.

1 / 3
Let’s picture it

A composite has a smaller prime factor.

2 multiples
3 multiples
5 multiples

Mark multiples of 2, then 3, then 5. Unmarked values remain prime.

Swipe when you’re ready
One little change

Start crossing at p squared.

2p done
3p done
p² starts new

Smaller multiples of p already had a smaller factor and were crossed out earlier.

Same idea. One more small step.
Now it has a name

Stop base primes at square root.

small factor
×
other factor

Any composite up to n has at least one factor no larger than √n.

Want to try a tiny question?
No pressure. Just try it.

Why can crossing multiples of p begin at p²?

You can also keep scrolling
1 / 4
Bits, math & geometry

One small step at a time.

This idea builds on these smaller ones. Pick any to revisit it here.

Now visit each stop.

Home
Park
Café

You don’t need three different instructions. “Visit the next place” works each time.

1 / 3
Let’s picture it

An exponent can halve.

x¹³
x·(x²)⁶

x¹³ = x·(x²)⁶. Squaring the base and halving the exponent skips repeated multiplication.

Swipe when you’re ready
One little change

Read exponent bits.

bit 1 → multiply
square
shift

When the current exponent bit is one, multiply the answer by the current base. Square the base every step.

Same idea. One more small step.
Now it has a name

Reduce throughout modular work.

reduce base
multiply
reduce again

(a·b) mod m equals multiplying their residues then reducing. This controls size and preserves the remainder.

Want to try a tiny question?
No pressure. Just try it.

How many squaring steps does exponent n need?

You can also keep scrolling
1 / 4
Bits, math & geometry

One small step at a time.

This idea builds on these smaller ones. Pick any to revisit it here.

Remainders make numbers smaller.

48
18
remainder 12

gcd(48,18) equals gcd(18,12), because 48 = 2·18 + 12.

1 / 3
Let’s picture it

Some recurrences are linear transitions.

state n
matrix
state n+1

Fibonacci keeps [F(n),F(n−1)]. One fixed 2×2 matrix advances that state by one step.

Swipe when you’re ready
One little change

Many equal steps can be squared.

T
T²
T⁴
T⁸

Applying transition T eight times is T⁸. Binary exponentiation squares matrices just like numbers.

Same idea. One more small step.
Now it has a name

State dimension controls cost.

small d
huge n

A d×d multiplication costs O(d³) naively. This helps when d is small and n is huge.

Want to try a tiny question?
No pressure. Just try it.

What property lets powers of one transition skip many steps?

You can also keep scrolling
1 / 4
Bits, math & geometry

One small step at a time.

This idea builds on these smaller ones. Pick any to revisit it here.

Where did we put the book?

Cup
Plate
Book
Pen

Try “second shelf, first box.” We need two positions, not just one.

1 / 3
Let’s picture it

Order may or may not matter.

choose:10
arrange:20

Choosing 2 people from 5 gives 10 groups. Arranging 2 roles from 5 gives 20 ordered assignments.

Swipe when you’re ready
One little change

Build binomial coefficients safely.

multiply next factor
divide by k

C(n,k)=C(n,k−1)·(n−k+1)/k. Divide at every step; the result stays integral.

Same idea. One more small step.
Now it has a name

State the counted objects first.

what differs?
does order matter?

Permutations, combinations, repeated choices, and indistinguishable items have different formulas.

Want to try a tiny question?
No pressure. Just try it.

Does C(n,k) distinguish the order of selected items?

You can also keep scrolling
1 / 4
Bits, math & geometry

One small step at a time.

This idea builds on these smaller ones. Pick any to revisit it here.

Now visit each stop.

Home
Park
Café

You don’t need three different instructions. “Visit the next place” works each time.

1 / 3
Let’s picture it

Three points reveal a turn.

left +
straight 0
right −

From A to B to C, a cross product is positive for a left turn, negative for right, and zero for collinear.

Swipe when you’re ready
One little change

Sign often matters more than angle.

cross sign
keep or pop

Convex-hull construction needs to know whether the boundary turns the allowed way, not the actual angle in degrees.

Same idea. One more small step.
Now it has a name

Sorting gives a walk around candidates.

sorted points
lower hull
upper hull

Sort points lexicographically, build lower and upper chains, and remove middle points that make the wrong turn.

Want to try a tiny question?
No pressure. Just try it.

What does a zero cross product mean?

You can also keep scrolling
1 / 4
Bits, math & geometry

One small step at a time.

This idea builds on these smaller ones. Pick any to revisit it here.

Find 8 in a sorted row.

2
4
6
8
10

Start with 2, 4, 6, 8, 10. Look at the middle: 6.

1 / 3
Let’s picture it

The stream length is unknown.

unknown length
one saved item

Items arrive one by one and cannot all be stored. We still want each final item equally likely.

Swipe when you’re ready
One little change

New item i gets chance 1/i.

replace: 1/i
keep: (i−1)/i

If selected, it replaces the reservoir. Otherwise the current sample stays.

Same idea. One more small step.
Now it has a name

Old items keep equal probability.

1/(i−1)
×(i−1)/i
=1/i

An earlier item survives step i with probability (i−1)/i, turning its prior 1/(i−1) chance into 1/i.

Want to try a tiny question?
No pressure. Just try it.

Must the total stream length be known beforehand?

You can also keep scrolling
1 / 4
Bits, math & geometry

One small step at a time.

This idea builds on these smaller ones. Pick any to revisit it here.

Now visit each stop.

Home
Park
Café

You don’t need three different instructions. “Visit the next place” works each time.

1 / 3
You've reached the end of these ideas.Try them without the labels