Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
T

technical-interview-prep

> 编程语言
Open source

These are coding solutions for problems I study while preparing for technical interviews at tech companies

682 stars0 likes0 views
WebsiteGitHub

About

These are coding solutions for problems I study while preparing for technical interviews at tech companies

Technical Interview Prep

Here are the sections:

  • How to Succeed in Data Structures and Algorithms Interview
  • Algorithms
  • Data Structures
  • Curated LeetCode Questions
  • AlgoExpert
  • Software Engineering
  • System Design

These are the best online resources that I used while preparing for technical coding interviews:

  • Cracking The Coding Interview: The most popular book on the whole tech interview process, now in 6th edition. 189 programming interview questions are included, ranging from the basics to the trickiest algorithm problems.
  • Elements of Programming Interviews: Another great book written by professional software engineers, with different versions in C++, Java and Python.
  • HackerRank: A technical recruiting platform that assesses developers based on actual coding skills.
  • Pramp: A free online peer-to-peer platform for practicing technical interviews.
  • LeetCode: One of the best online resource providing a rich library of more than 300 real coding interview questions with 7 supported languages - C, C++, Java, Python, C#, JavaScript, Ruby.
  • Interview Cake: Another site that preps software engineering candidates for coding interview.
  • AlgoExpert: The ultimate resource to prepare for coding interviews. Everything you need, in one streamlined platform.
  • Software Engineering Interview Preparation: All the required theoretical material needed to pass a Facebook/Google software engineering interview.

How to Succeed in Data Structures and Algorithms Interview

To practice your algorithmic coding, review this interview preparation document.

  • Preparation
  • Understand the Problem
  • Brute Force Solution
  • Optimize Your Solution
  • Code Your Solution
  • Test Your Solution

Preparation

  • Develop a deep knowledge of data structures: You should understand and be able to talk about different data structures and their strengths, weaknesses, and how they compare to each other. Taking the time to implement data structures from scratch will leave you much better prepared for DS&A interviews, than studying them as an abstract concept.
  • Understand Big O notation: You should be able to talk about Big O notation for both time and space complexity. Make sure to read about common algorithms and their memory and runtime complexity to train your big O analysis muscle.
  • Know the major sorting algorithms: Given that differences in time and space complexity can derail your optimal solution for an algorithm problem, it’s good to be familiar with the major algorithms per category (string matching, sorting, search, graph, traversal, etc).

back to current section

Understand the Problem

  • To verify your understanding, repeat the question back to the interviewer in your own words to make sure you got it correctly. There’s nothing worse than realizing mid-interview that you’re answering a completely different question. It could be helpful to use a test or two to verify your understanding of the problem.
  • You should feel comfortable asking your interviewer questions to define any ambiguities and ask them if you can make certain assumptions (e.g. “Can I assume the array is sorted?” or “Can I assume the input is valid?”). Remember that the interviewer’s goal is to get a good signal for how you think through an issue or problem.
  • You may consider asking them the following questions:
    • How large is the range of values? What kind of values exists?
    • How large is the size of the input? Are there duplicates within the input?
    • What are some extreme cases of inputs?
    • How is the input stored?
  • You should also ask whether you’ll eventually be optimizing for time, space, or both. Even if you believe you already know how to solve the problem, it’s important to ensure that you’re spending your time implementing the solution that your interviewer cares about.
  • Keep track of how much time you’re spending in the ideation phase to leave yourself enough time to code your solution.

back to current section

Brute Force Solution

  • The worst outcome in a technical interview is to not write any code, and the easiest way to end up in that position is to overcomplicate the problem early in the interview.
  • Instead, talk through a solution you’re confident will work and let your interviewer know about the concessions you’ve made. You might think that if you present an initial suboptimal solution that you’ll never get hired, but this isn’t true. Communication is important here. You can score points with your interviewer by explaining the time and space complexity of your naive or brute-force solution and by clarifying why it’s suboptimal; you’ll have the chance to improve it later.
  • Now that you’ve talked through the brute-force solution, ask the interviewer whether they’d like you to implement the brute force solution or come up with a more efficient solution. If the former, skip the next section “Optimize your Solution” and come back to it at the end. Only start coding once you and your interviewer have agreed on an approach and they’ve given you the green light to move ahead.

back to current section

Optimize Your Solution

  • Discuss your approach with your interviewer and lean on them to get a sense of whether they have a preference for whether you optimize for time, space, or both. When optimizing, some of your initial assumptions may change, so it’s important to check with your interviewer.
  • You may see the most optimal solution right away or be unsure on how to proceed. If you’re stuck, here are some common approaches to optimizing:
    • Take a second look at the problem, its constraints, and write down your assumptions and possible simplifications.
    • Consider similar problems you’ve seen and discuss them with your interviewer.
    • Solve an example by hand and extrapolate about what algorithm(s) could be used.
    • Simulate the brute-force solution by hand and identify the inefficiencies that could be optimized with a data structure.
    • Solve a simple version of the problem first, then build on it.
  • Don’t forget to communicate and analyze the time or space complexity of the solution you plan to optimize. Once you and your interviewer agree that you have a good solution, it’s time to code it.

back to current section

Code Your Solution

  • As an interviewee, it’s important to ensure that your interviewer understands what you’re doing and why you’re doing it in real-time. If you’re explaining your thought process out loud and you take a wrong turn, your interviewer may offer you a hint to get you back on track.
  • While you’re coding, don’t read your code verbatim; but rather, talk about the section of the code you’re implementing at a higher level. Explain why you wrote it that way and what it’s trying to achieve.
  • Remember that your interviewer needs to be able to understand your code to efficiently evaluate whether your code returns the expected result and solves the problem. As you code, keep these pointers in mind:
    • Use good style when writing your code.
    • Naming Matters.
    • Demonstrate good modularity.
    • Leave time to check for bugs and edge cases.
    • If cutting corners, explain it to your interviewer.
  • Take a step back and briefly read through your solution, examining it as if it were written by someone else, but don’t start debugging it manually. This is the same approach that will be taken by your interviewer. Fix any issues you may find.
  • Then walk your interviewer through the code and explain your rationale. If you find a bug or mistake, feel free to acknowledge it and make the change.

back to current section

Test Your Solution

  • During the testing portion of the interview, you should have a few goals in mind. You want to…
    • Demonstrate that you care that your code actually works.
    • Show that you can understand and solve problems even if it doesn’t work.
    • Exhibit your understanding of the various edge cases that a real-world problem might present.
    • Establish a feedback loop for your code that allows refactoring without having to worry about breaking existing functionality.
  • There are a few types of inputs you’re going to test for:
    • Large and small valid inputs.
    • Large and small invalid inputs.
    • Random input.
  • For each input, manually go through your code and ensure that it performs. You should jot down or tell your interviewer the values of each variable as you walk them through the code.
  • If you find an error, explain the error to your interviewer, fix it, and move on. Similarly, if there are large duplicated code blocks in your solution, you can take the time to restructure the code.
  • In this stage, you’ll also have the opportunity to showcase your knowledge around automated testing. You can chat about how you’d generate different types of inputs, how you would stub parts of the code, the test runners you’d use, and more. These are all great signals to show an interviewer.

back to current section

back to top

Algorithms

Here are the algorithms:

  • Sorting
  • Tree Traversals
  • Graph Traversals
  • Backtracking
  • Binary Search
  • Breadth First Search
  • Depth First Search
  • Recursion

Sorting

Bubble Sort

  • This simple sorting algorithm iterates over a list, comparing elements in pairs and swapping them until the larger elements "bubble up" to the end of the list, and the smaller elements stay at the "bottom".
  • Implementation
  • In the worst case scenario (when the list is in reverse order), this algorithm would have to swap every single item of the array. Therefore, if we have n elements in our list, we would have n iterations per item - thus Bubble Sort's time complexity is O(n^2).

Selection Sort

  • This algorithm segments the list into two parts: sorted and unsorted. We continuously remove the smallest element of the unsorted segment of the list and append it to the sorted segment.
  • Implementation
  • For a list with n elements, the outer loop iterates n times. The inner loop iterate n-1 when i is equal to 1, and then n-2 as i is equal to 2 and so forth. The amount of comparisons are (n - 1) + (n - 2) + ... + 1, which gives Selection Sort a time complexity of O(n^2).

Insertion Sort

  • Like Selection Sort, this algorithm segments the list into sorted and unsorted parts. It iterates over the unsorted segment, and inserts the element being viewed into the correct position of the sorted list.
  • Implementation
  • In the wors

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

C++algorithms-interviewc-plus-plusdata-structuresleetcode

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言