DSAWiser

DSA question set · 29 questions

Getting Started with DSA Practice and Code Visualization

Build DSA basics with counting, loops, functions, and small numerical problems. Run examples and trace your own solutions in DSAWiser’s code visualizer.

RecursionMathArraysStrings

Start with the smaller skills

This collection is a starting point for Basic coding practice. Work on reading inputs, writing loops, calling functions, and returning the expected result before combining those skills into a larger DSA problem.

The production collection starts with printing numbers, repeating a word, and summing natural numbers. Problems such as factorial, powers, and counting digits then give you more practice with stopping conditions and changing state. Use the question list below as the source of the collection’s current contents.

Before you start

You need a little familiarity with your chosen language: variables, comparisons, function arguments, and output. If one of those still feels uncertain, use a small input in the visualizer to see what changes after each statement.

You do not need to know hash maps, dynamic programming, or a catalog of interview patterns to begin here.

A practical way to solve each question

  1. Read what the function must return. Distinguish returning a value from printing it.
  2. Write the expected result for a small input by hand. Check the smallest valid input too.
  3. Describe each step in plain words, then translate those steps into code.
  4. Run the examples. For counting and loops, check the first and last iteration carefully.
  5. Step through the solution and compare each variable with your prediction. Use a breakpoint just before a step you want to inspect.

Check the stopping condition

Many small mistakes come from doing one iteration too many, starting at the wrong number, or returning before the work is complete. Before running your solution, predict how many times the loop or recursive function should execute.

When you move on to a larger collection, keep the same habit: state the result you want, choose a small example, and inspect the intermediate steps. The related Two Sum walkthrough shows how this approach extends to a different problem; it is further reading, not a question in this collection.

Questions in this set

29 total

Open a question in the editor to read its statement and examples. Sign in to practice.

  1. Print Numbers from 1 to NRecursion · MathBasic
  2. Print Numbers from N Down to 1Recursion · MathBasic
  3. Print a Word N TimesRecursionBasic
  4. Sum of First N Natural NumbersRecursion · MathBasic
  5. Factorial of a NumberRecursion · MathBasic
  6. Power of a Number (aᵇ)Recursion · MathBasic
  7. Count Digits of a NumberRecursion · MathBasic
  8. Sum of Digits of a NumberRecursion · MathBasic
  9. Product of Digits of a NumberRecursion · MathBasic
  10. Greatest Common Divisor (GCD)Recursion · MathBasic
  11. N-th Fibonacci NumberRecursion · MathBasic
  12. Check Power of TwoRecursion · MathBasic
  13. Sum of Array ElementsRecursion · ArraysBasic
  14. Find Maximum Element in an ArrayRecursion · ArraysBasic
  15. Find Minimum Element in an ArrayRecursion · ArraysBasic
  16. Linear Search in an ArrayRecursion · ArraysBasic
  17. Count Occurrences in an ArrayRecursion · ArraysBasic
  18. Find First Index of an ElementRecursion · ArraysBasic
  19. Count Even Numbers in an ArrayRecursion · ArraysBasic
  20. Check if Array is SortedRecursion · ArraysBasic
  21. Length of a StringRecursion · StringsBasic
  22. Count Vowels in a StringRecursion · StringsBasic
  23. Count Occurrences of a CharacterRecursion · StringsBasic
  24. Check if String is a PalindromeRecursion · StringsBasic
  25. Reverse a StringRecursion · StringsBasic
  26. Remove All Occurrences of a CharacterRecursion · StringsBasic
  27. Replace Character in a StringRecursion · StringsBasic
  28. Count Steps to Reduce to ZeroRecursion · MathBasic
  29. Check if All Elements are PositiveRecursion · ArraysBasic