Founding Batch Offer · HLD · LLD · System Design at ₹799 until 30 Nov

ProgramsLogic building

Phase 3 - Level 2: Advanced Recursion

Master advanced recursive patterns - digit operations, GCD, binary conversion.

10 programs · open one, then the next

Start with Count Digits Recursively
  1. 01Count Digits RecursivelyIntermediateCount integer digits using recursive floor division. Students trace one count per decimal position and separate zero input from the helper's empty remainder.Open example →
  2. 02Reverse Number RecursivelyIntermediateReverse an integer by carrying a partial result through recursive calls. Students trace a shrinking argument, an expanding accumulator, and sign restoration.Open example →
  3. 03Check Palindrome RecursivelyIntermediateCheck numeric palindromes with a recursive reverse helper. Students compare an unchanged magnitude with an accumulator result and trace the stopping case.Open example →
  4. 04Product of Digits RecursivelyIntermediateMultiply digits with a recursive helper. Students distinguish the empty-product base case from a literal zero digit and trace short-circuiting on internal zeros.Open example →
  5. 05GCD RecursivelyIntermediateFind a GCD with Euclid's recursive algorithm. Students trace remainders, argument swapping, absolute values, and a zero second argument as the base case.Open example →
  6. 06Convert Number to Binary RecursivelyIntermediateBuild a binary representation recursively. Students divide by two, append remainder bits on return, and supply a visible zero for an empty base result.Open example →
  7. 07Print Digits in WordsIntermediatePrint each decimal digit as an English word using recursion. Students delay output until smaller prefixes return and handle zero as a complete input separately.Open example →
  8. 08Sum of First N Even Numbers RecursivelyIntermediateSum the first n positive even numbers with recursion. Students distinguish a term count from an upper limit and trace two-times-n additions to the base case.Open example →
  9. 09Sum of First N Odd Numbers RecursivelyIntermediateSum the first n positive odd numbers through recursion. Students trace the term formula, a zero-count base case, and unfinished additions on the call stack.Open example →
  10. 10nCr Recursively (Pascal Formula)AdvancedCompute combinations with Pascal's recursive formula. Students trace two smaller subproblems, edge entries equal to one, and repeated work in the call tree.Open example →