Skip to content

Solutions to the 189 questions from the book "Cracking the Coding Interview". In addition, contains a 'Core' project to which great miscelanious code implementations live (Main languages; Python, JavaScript + C#, Bonus languages; Swift, Java + C++)

alpha-nero1/CrackingTheCodingInterview

Repository files navigation

⌨️ Cracking The Coding Interview.

In this project I will complete all 189 of the cracking the coding interview's algorithms. I also include a handy Core folder with great common/useful/awesome programming implementations like hashtables, linked lists, core sorting/searching algos and much more.

Questions will be answered in:

  • Python
  • JavaScript
  • C#
  • Java
  • Swift
  • C++

Questions will mainly be done in JavaScript, Python and C# as they are awesome languages (and the ones I find have the most use to me). I will, however, occasionally dabble in Java, Swift and C++ as they are important but I wouldn't find myself using them on the day-to-day.

⚠️ Algo Tips

  • Everything is figureoutable, take your time, understand the question and if you need help, reference the answers, it's a learning process anyway.
  • Do just a bit each day, there are too many questions here to worry about in large chunks.
  • It's a long road, just remember, it is a process.
  • The chapter introductions have really good information on the topics before you go into them, it is essential to have some notes on these and understand key concepts before running head first into the problems.

✅ Core Progress (3 questions from each chapter)

Because it is a large book, the goals of completion have been split into 2. The first is to get the "Core" out of the way (3 questions from each chapter). The second is to finish off the rest.

  • Remember that chapters 1-8 have been done to completion.
  • 31 / 51 (60.7)
  • 34 / 51 (66.6)
  • 42 / 51 (78.8)
  • 48 / 51 (94.1)
  • 51 / 51 (100) !!!

✅ Total Progress

first 7 chapters progress = 9 + 8 + 6 + 12 + 8 + 10 + 9 = 62

  • 62 + 11 = 73 / 189 (38.6)
  • 62 + 48 - 21 = 89 / 189 (47.0)
  • 62 + 51 - 21 = 92 / 189 (48.6)
  • 94 / 189 (49.7) (includes 8.4 and 8.5)
  • 98 / 189 (51.8) (invludes 8.9)
  • 99 / 189 (52.3) (includes 8.10)
  • 100 / 189 (52.9) (includes 8.11)
  • 101 / 189 (53.4) (includes 8.12)
  • 108 / 189 (57.1) (includes 9.8)
  • 112 / 189 (59.2) (includes 10.6 + 11.4)
  • 117 / 189 (61.9) (includes 10.11)
  • 121 / 189 (64.0) (includes 12.5)
  • 123 / 189 (65.0) (includes 12.7)
  • 129 / 189 (68.2) (includes 13.5)
  • 136 / 189 (71.9) (includes 15.3)
  • 141 / 189 (74.6) (includes 16.4)
  • 144 / 189 (76.1) (includes 16.7)
  • 149 / 189 (78.8) (includes 16.12)
  • 153 / 189 (80.9) (includes 16.16)
  • 154 / 189 (81.4) (includes 16.17)
  • 156 / 189 (82.5) (includes 16.19)
  • 157 / 189 (83.0) (includes 16.20)
  • 166 / 189 (87.8) (includes 16.26)
  • 167 / 189 (88.3) (includes 17.4)
  • 170 / 189 (89.9) (includes 17.7)
  • 171 / 189 (90.4) (includes 17.8)
  • 173 / 189 (91.5) (includes 17.10)
  • 174 / 189 (92.0) (includes 17.11)
  • 175 / 189 (92.5) (includes 17.12)
  • 177 / 189 (93.6) (includes 17.14)
  • 178 / 189 (94.1) (includes 17.15)
  • 179 / 189 (94.7) (includes 17.16)
  • 180 / 189 (95.2) (includes 17.17)
  • 181 / 189 (95.7) (includes 17.18)
  • 182 / 189 (96.2) (includes 17.19)
  • 183 / 189 (96.8) (includes 17.20)
  • 184 / 189 (97.4) (includes 17.21)
  • 187 / 189 (98.9) (includes 17.24)
  • 188 / 189 (99.4) (includes 17.25)
  • 189 / 189 (100.0) (includes 17.26)
  1. Sorting and Searching [X]

  2. Testing [X]

  3. C and C++ [X]

  4. Java [X]

  5. Databases [X]

  6. Threads and locks [X]

  7. Moderate [X]

  8. Hard [X]

Nice VSCode shortcuts.

  • home: cursor to start of line.
  • end: cursor to end of line.
  • ctl + l: highlight current line.
  • shift + alt + down: copy same line down.

Weird questions

  • 8.4
  • 8.14
  • 16.18 - question does not make sense.

Very interesting and not fully understood

  • 8.7.
  • 8.11.
  • 17.25. Word rectangle, must be a nicer way of doing this...

Just mindblowing/awesome

Chapter 8

  • 8.10 tryed to do something similar before but never succeeded.
  • 8.12 place queens on chessboard, thought it was impossible, but so simple.

Chapter 10

  • 10.8 Find duplicate numbers using a byte[] bitmap.
  • 10.10 Easily track the ranking of a stream of numbers.
  • 10.11 Really cool easy way of sorting an array into peaks and valleys.

Chapter 11

  • 10.5 How would you test a pen?

Chapter 13

  • 13.7 Lamdas in Java use ->

Chapter 14

  • 14.1 Simple and effective use of the HAVING keyword.
  • 14.7 Exellent use of a subquery.

Chapter 15

  • 15.3 The chopsticks dilema!
  • 15.7 Subclassing Thread!

Chapter 16

  • 16.1 Swap ints without a temp variable.
  • 16.4 Brilliant way of traversing a matrix diagonally.
  • 16.6 Great example of using a and b cursors to iterate through two arrays to get smallest pairs.
  • 16.7 Crazy way to find the max number without any if else.
  • 16.8 Convert an integer to the english spelling.
  • 16.15 real show of prowess with JS closures.
  • 16.19 pond counter! knocked it out of the park!
  • 16.24 great way of finding pairs in an array that make a sum!
  • 16.26 Awesome calculator implementation! This is easily one of my most prized algorithms.

Chapter 17

This chapter was definitelty really hard and required reading through solutions properly in order to understand the concept before programming.

  • 17.7 Really excellent use of Graphs to find similar name frequencies!
  • 17.9 (Kth Multiple) Very interesting algorithm, needs more time to comprehend.
  • 17.10 (Majority Element). Very clever way of getting the majority element in an array.
  • 17.21. (Volume of histogram). very clever way of using an array of maxes to simplify a problem.

Extended Backlog

  • Generics for C++ functions (try linear search first) [x]
  • Write tests for C# Set, Queue and Stack [x]
  • C++ get unit tests running [x]
  • C++ complete project structure [x]
  • C++ write file on pointers and refs [x]
  • C++ comprehensive example of multi dimenstional arrays and pointers [x]
  • C++ use of vector [x]
  • C# Use trie to return autocomplete results []
  • C++ write a sorting algorithm []
  • C++ hashtable re-write with generics []
  • C++ build base and subclass classes []

After this create a sample signal R messaging app []

About

Solutions to the 189 questions from the book "Cracking the Coding Interview". In addition, contains a 'Core' project to which great miscelanious code implementations live (Main languages; Python, JavaScript + C#, Bonus languages; Swift, Java + C++)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published