Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

234 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Readme


Tracker




Process of solving a leetcode question

  1. Read the question.
    • Read the question complemently.
    • Understand what is needed to be done?
    • Something to be returned or done in place?
  2. Confirm understanding.
    • Pick a simple example case and write down the expected outcome and confirm if the understanding is correct.
  3. Ask clarification questions.
  4. Prepare test cases.
  5. Come up with brute force solution.
  6. Develop an optimised solution.



Array based questions



Typical clarification questions

  1. What is the type of data stored in the array?

    • If the data type is integers, then it contains positive, negative and zeros.
  2. Is the array sorted?

  3. Is the array comprised of unique elements?

  4. Can the array be modified?

    • If the question demands "in-place" logic, it means array must be modified.
  5. Can the array be empty?



Test cases

Case Array
Empty Array []
Array with single element [100]
Array with positive elements [1,2,3]
Array with dupliates [1,2,2,4]
Array with polarity [-1,0,1]



Matrix based questions

Matrix is typically a 2D array.



Typical clarification questions

  1. What is the minimum and maximum dimensions of the givem m*n matrix?

    • Example answer: 1 <= m, n <= 200
  2. Any input constraints on the element, data type and values?

    • Example answer: -2^31 <= matrix[i][j] <= 2^31 - 1
  3. Do we have the liberty to modify the type and value of the elements?

    • Example answer: Matrix must contain integer types, values can be modified.
  4. Can the matrix be empty?

    • Example answer: No, at the very least matrix contains only 1 cell.


Test cases

Case Matrix



About

All my leetcode code.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages