Skip to main content

Getting Started

1] Define the Problem and validate the inputs

Input:
  • Is it a single array? Or multiple arrays?
  • Are there any constraints on the size of the array?
  • Can the array contain negative numbers, floating-point numbers, or other data types?
Output:
  • Is it a single value, an array, or something else?
  • Are there any specific requirements or constraints on the output format?
Problem Constraints:
  • Are there any time complexity requirements for the solution?
  • Are there any space considerations for the solution?
Edge Cases:
  • Should the algorithm handle edge cases such as
    • empty array?
    • arrays with only one element?
    • arrays with all identical elements?

2] Recognize Pattern:

Recognize the Brute Force Solution 

  • typicallyUnderstand athe nestedProblem: loop
      which
    • Read runsand atcomprehend n2the problem statement.
    Recognize
  • Clarify Doubts:
    • Ask the Usinginterviewer Spacefor (Hash)clarification if needed.
  • Ask Questions:
    • Gather more information about the problem.
  • Design a Plan:
    • Devise an approach to Solvesolve the Solutionproblem.
    HashSet's
  • maximum
  • Break size is constant (at most 26 characters),Down the Problem:
    • Divide the problem into smaller subproblems if necessary.
  • Choose the Right Data Structures and Algorithms:
    • Select appropriate tools based on problem requirements.
  • Write Pseudocode:
    • Outline the solution logic without worrying about syntax.
  • Code Implementation:
    • Write the actual code following best practices.
  • Test Your Solution:
    • Verify correctness and robustness with test cases.
  • Optimize if Necessary:
    • Improve time or space complexity isif ,possible.
    • meaning
    it
  • is
  • Handle constant.

    Recognize Language specific solves 

    Time/Space considerations:

    In-place solutions (big-o):

    Time Complexity:

    Space Complexity: 

    Design Pseudocode

    3]Create a function,Errors and returnEdge Cases:
    • Ensure graceful handling of errors and edge cases.

  • Review and Debug:
    • Check for errors and bugs, and troubleshoot as needed.
  • Communicate Your Thought Process:
    • Explain your approach and reasoning to the answerinterviewer.
    • immediately
    if
  • false,
  • Be otherwiseFlexible whenand loopAdaptive: is
      completed,
    • Adapt ityour isapproach likelybased true.on

      feedback or new insights.
  • Practice Regularly:
    • Improve problem-solving skills through practice and mock interviews.

4] when in doubt, use Sort which is nlogn where n is the number of elements in array to go through.