Skip to content

Collection of coding questions found in sites like LeetCode, HackerRank, CodingBat, and other sources. All questions are solved in Java. Questions contain solutions and comments.

Notifications You must be signed in to change notification settings

JesusNunez1031/Coding-Questions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Coding-Questions

Collection of coding questions taken from Cracking the coding interview book, LeetCode, HackerRank, CodeWars, CodingBat.com and other sources. All questions are solved using Java language. Directories are named after the source of the question so all leetcode questions I have done can be found in said directory. Questions are also organized by topics

Daily updates will be added as I continue to solve more from leetcode and HackerRank. Complex questions include comments to help understand approach. I try to come up or find the easiest solutions to problems to ensure the comprehension of the code is clear. I like to believe that if a question is giving you a rough time, it's ok to see a good solution and learn from it rather than making it more complex.

Essential Data Structures

  1. Primitive Arrays
  2. 2-D Arrays
  3. Lists (e.g. Linked Lists, Array Lists)
  4. Stacks
  5. Queues, Deque, Priority Queues
  6. Maps (e.g. Sets, Hash Maps)
  7. Binary Trees

Tips For Approaches to Algorithm Questions

  1. If the given array is sorted consider using,
    • Binary Search
    • Two Pointers
  2. If asked to give all leetCode.backtracking.permutations/leetCode.backtracking.subsets for a given set of data,
    • Backtracking
    • Sorting given data can help reduce extra work
  3. If given a Tree or Graph,
    • DFS (Depth First Search)
    • BFS (Breath First Search)
  4. If given a linked list,
    • Two Pointers
  5. If recursion is not allowed, a stack is equivalent to the recursion stack used by the compiler
  6. If you're not allowed to use other data structures and must solve in-place consider,
    • swapping values
    • store one or more different values in the same pointer
  7. If asked for maximum/minimum subarray/subsest/options,
    • Dynamic Programming
  8. If asked for top/least K items,
    • Heaps (e.g. Priority Queues)
  9. If asked for common strings, string prefixes, etc.
    • Map
    • Trie
  10. If asked for prefix sums
    • Binary Indexed Trees
  11. If multiplication, addition, division, subtraction are not allowed
    • Bitwise operators

References to Curated Questions

Contributions

Feel free to make pull request's to add comments or suggest improvements on the code currently available. Also, check out my Algorithms and data-structures repo for help on implementing specific data structures; more will be added as I continue to study topics.

About

Collection of coding questions found in sites like LeetCode, HackerRank, CodingBat, and other sources. All questions are solved in Java. Questions contain solutions and comments.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published