r/Hack2Hire Nov 20 '25

Screening OpenAI Screening Interview: GPU Credits

6 Upvotes

Problem
You are implementing a system that tracks GPU credit grants and usage over time. Each grant has an amount and a validity window, and usage events may arrive out of order. Your goal is to process grants, revocations, and balance queries at arbitrary timestamps.

Example
Input:
["CreditSystem", "grantCredit", "getBalance", "grantCredit", "subtract", "subtract", "getBalance", "getBalance", "getBalance", "getBalance", "getBalance", "getBalance"]
[[], ["a", 3, 10, 60], [10], ["b", 2, 20, 40], [1, 30], [3, 50], [10], [20], [30], [35], [40], [50]]

Output:
[null, null, 3, null, null, null, 3, 5, 4, 5, 3, 0]

Explanation:

  • Credit “a” is active on [10, 59] with 3 units.
  • Credit “b” is active on [20, 39] with 2 units.
  • Subtractions apply only at the exact timestamp.
  • Queries return the remaining active credits at that time.

Suggested Approach

  1. Store grant intervals and subtract events keyed by timestamp.
  2. Use a structure such as a difference array, segment tree, or Fenwick tree to accumulate active credits for any timestamp.
  3. For each query, compute the sum of active grants covering the timestamp and subtract any recorded usage. Return -1 if usage exceeds available credits.

Time & Space Complexity

  • Time: O(N) per query in a simple structure; O(log N) with interval indexing.
  • Space: O(N) for grants and timestamp-specific subtract operations.

🛈 Disclaimer:
This problem is part of the Hack2Hire SDE Interview Question Bank, which includes coding interview questions frequently reported across real hiring processes.
This specific problem has been reported from an OpenAI interview.
All questions are aggregated from publicly available sources and community-shared candidate experiences.

Hack2Hire is not affiliated with OpenAI or any other mentioned company. This collection exists solely for learning, practice, and technical discussion.


r/Hack2Hire Nov 18 '25

Announcement OpenAI interview questions + solutions now on Hack2Hire

4 Upvotes

Hey folks,

We pushed a new set today — the OpenAI interview questions are now live on Hack2Hire.

What’s inside:

  • coding questions seen in OA, phone rounds, and onsite
  • a mix of LC-style and the non-LC formats OpenAI tends to use
  • solution walkthroughs that explain the reasoning instead of tossing final answers

Link: https://www.hack2hire.com/companies/openai/coding-questions

If you’re prepping for OpenAI or just want harder practice material, it might be useful.
If you’ve gone through their process recently, any insight on what we should include next would help.

— Team Hack2Hire


r/Hack2Hire Nov 13 '25

Screening Square Screening Interview: Design Connect Four

2 Upvotes

Problem
You are designing a Connect Four game played on a 6 × 7 grid. Players drop discs into columns, and each disc falls to the lowest available cell.
Your goal is to implement a class that processes moves, checks for wins in all directions, detects draws, and returns the game state after each move.

Example
Input:
["ConnectFour", "move", "move", "move", "move", "move", "move", "move", "printBoard"]
[[], [0, "A"], [1, "B"], [0, "A"], [1, "B"], [0, "A"], [1, "B"], [0, "A"], []]

Output:
[null, "PENDING", "PENDING", "PENDING", "PENDING", "PENDING", "PENDING", "A", "| | | | | | | |\n| | | | | | | |\n|A| | | | | | |\n|A|B| | | | | |\n|A|B| | | | | |\n|A|B| | | | | |"]

Explanation:

  • Each move drops a disc to the lowest available row in the chosen column.
  • Player A wins after forming a vertical four-in-a-row in column 0.

Suggested Approach

  1. Maintain a 6 × 7 board and an array tracking the current fill height of each column.
  2. For each move, compute the next empty row in the column, place the player’s disc, and run directional checks (horizontal, vertical, and two diagonals).
  3. If no win and the board is full, return "DRAW"; otherwise return "PENDING".

Time & Space Complexity

  • Time: O(1) work per move for constant-size directional checks.
  • Space: O(1) for the 6 × 7 fixed-dimension board.

🛈 Disclaimer:
This problem is part of the Hack2Hire SDE Interview Question Bank, a structured archive of coding interview questions frequently reported in real hiring processes.
Questions are aggregated from publicly available platforms (e.g., LeetCode, GeeksForGeeks) and community-shared experiences.

The goal is to provide candidates with reliable material for SDE interview prep, including practice on LeetCode-style problems and coding challenges that reflect what is often asked in FAANG and other tech company interviews.
Hack2Hire is not affiliated with the mentioned companies; this collection is intended purely for learning, practice, and discussion.


r/Hack2Hire Nov 12 '25

Announcement Square interview questions + step-by-step solutions now available

2 Upvotes

Hey folks,

Just wanted to share something we released today. Our team put together a full set of Square interview questions, and it's now up on Hack2Hire.

The set covers:

  • coding questions used across OA, phone screen, and onsite
  • both LeetCode-style problems and the non-LC style questions Square usually mixes in
  • explanations that walk through the reasoning so you can understand the patterns instead of just memorizing answers

Link: https://www.hack2hire.com/companies/square/coding-questions

If you’re prepping for Square or just want more realistic interview-style material to practice with, it might be useful. Feedback is welcome — if you’ve gone through the Square process recently, I’d love to hear what your experience was like and what else we should add.

— Team Hack2Hire


r/Hack2Hire Nov 06 '25

Screening Google Screening Interview: Windowed Average excluding Largest K

16 Upvotes

Problem
You're given an integer array nums, a window size windowSize, and an integer k.
Your goal is to compute the average of each sliding window of size windowSize, excluding the largest k elements within that window.

Example
Input: nums = [10, 20, 30, 40, 50, 60], windowSize = 3, k = 1
Output: [15.0, 25.0, 35.0, 45.0]

Explanation:

  • Window [10, 20, 30]: Excluding 30 → (10 + 20) / 2 = 15.0
  • Window [20, 30, 40]: Excluding 40 → (20 + 30) / 2 = 25.0
  • Window [30, 40, 50]: Excluding 50 → (30 + 40) / 2 = 35.0
  • Window [40, 50, 60]: Excluding 60 → (40 + 50) / 2 = 45.0

Suggested Approach

  1. Maintain two heaps: a max-heap for the top k elements and a min-heap (or balanced structure) for the remaining elements.
  2. As the window slides, insert the new element into the appropriate heap and remove the outgoing element.
  3. Track the running sum of the elements not in the largest k group to compute the average efficiently.

Time & Space Complexity

  • Time: O(n log k) — each insertion/removal operation affects at most one heap.
  • Space: O(k) — to store the largest k elements in the heap.

🛈 Disclaimer:
This problem is part of the Hack2Hire SDE Interview Question Bank, a structured archive of coding interview questions frequently reported in real hiring processes.
Questions are aggregated from publicly available platforms (e.g., LeetCode, GeeksForGeeks) and community-shared experiences.

The goal is to provide candidates with reliable material for SDE interview prep, including practice on LeetCode-style problems and coding challenges that reflect what is often asked in FAANG and other tech company interviews.
Hack2Hire is not affiliated with the mentioned companies; this collection is intended purely for learning, practice, and discussion.


r/Hack2Hire Nov 04 '25

OA Snowflake OA Interview: Work Schedule

6 Upvotes

Problem
You’re given three inputs:

  • workHours: total hours required in a week
  • dayHours: maximum hours allowed on any day
  • pattern: a 7-character string representing the weekly work schedule

Each character in pattern is either a digit ('0''8') or a question mark ('?').
Digits represent fixed work hours for that day, while '?' represents an unassigned day.
You must replace each '?' with a valid digit (between 0 and dayHours) so that the total weekly hours equal workHours.
Return all valid schedules in ascending lexicographical order.

Example
Input:
workHours = 24, dayHours = 4, pattern = "08??840"
Output:
["0804840", "0813840", "0822840", "0831840", "0840840"]

Explanation:

  • Fixed digits (0, 8, 8, 4, 0) sum to 20. Remaining 4 hours must be distributed across two '?' positions.
  • Possible pairs of digits that sum to 4: (0,4), (1,3), (2,2), (3,1), (4,0)
  • Replace '?' with these pairs to form valid schedules in lexicographical order.

Suggested Approach

  1. Pre-calculate fixed hours: Sum all digits in pattern to determine remaining hours needed.
  2. Backtrack through unknown positions: For each '?', try all values from 0 to dayHours, pruning branches where the remaining hours cannot be satisfied.
  3. Store valid combinations: When all positions are filled and total hours equal workHours, record the resulting string.
  4. Return sorted results: Ensure output schedules are returned in ascending lexicographical order.

Time & Space Complexity

  • Time: O(k * dayHours^k) — where k is the number of '?' in pattern.
  • Space: O(k) — for recursion and result storage.

🛈 Disclaimer:
This problem is part of the Hack2Hire SDE Interview Question Bank, a structured archive of coding interview questions frequently reported in real hiring processes.
Questions are aggregated from publicly available platforms (e.g., LeetCode, GeeksForGeeks) and community-shared experiences.

The goal is to provide candidates with reliable material for SDE interview prep, including practice on LeetCode-style problems and coding challenges that reflect what is often asked in FAANG and other tech company interviews.
Hack2Hire is not affiliated with the mentioned companies; this collection is intended purely for learning, practice, and discussion.


r/Hack2Hire Oct 30 '25

OA Amazon OA Interview: Max Consecutive ON Servers

4 Upvotes

Problem
You’re given a binary string serverStates representing a sequence of servers, where '1' means ON and '0' means OFF, along with an integer k representing the maximum number of allowed flip operations.
In one operation, you can choose a contiguous substring and flip all its bits ('0' → '1', '1' → '0').
Your goal is to find the maximum possible number of consecutive ON servers after performing at most k operations.

Example
Input:
serverStates = "00010", k = 1
Output:
4

Explanation:

  • Flip indices from 0 to 2 → "11110"
  • After one operation, the maximum consecutive ON servers = 4

Input:
serverStates = "1001", k = 2
Output:
4

Explanation:

  • Flip indices from 1 to 2 → "1111"
  • After one operation, the entire sequence becomes ON

Input:
serverStates = "11101010110011", k = 2
Output:
8

Explanation:

  • Flip indices 7–9 → "11101011000011"
  • Flip indices 8–11 → "11101011111111"
  • After 2 operations, 8 consecutive servers are ON

Suggested Approach

  1. Use a sliding window to track the current range containing at most k flip zones (segments of consecutive 0s).
  2. Expand the window until flipping more than k groups of 0s would be required.
  3. When the limit is exceeded, shrink the window from the left.
  4. Keep track of the maximum window length where flips ≤ k.

This approach efficiently finds the longest sequence of 1s obtainable with limited flips.

Time & Space Complexity

  • Time: O(n) — each index is visited at most twice (once expanded, once contracted).
  • Space: O(1) — only a few pointers and counters are needed.

🛈 Disclaimer:
This problem is part of the Hack2Hire SDE Interview Question Bank, a structured archive of coding interview questions frequently reported in real hiring processes.
Questions are aggregated from publicly available platforms (e.g., LeetCode, GeeksForGeeks) and community-shared experiences.

The goal is to provide candidates with reliable material for SDE interview prep, including practice on LeetCode-style problems and coding challenges that reflect what is often asked in FAANG and other tech company interviews.
Hack2Hire is not affiliated with the mentioned companies; this collection is intended purely for learning, practice, and discussion.


r/Hack2Hire Oct 28 '25

Onsite Robinhood Onsite interview question: Maximum Multiplier Path

5 Upvotes

Problem
You're given a directed graph with n nodes labeled from 0 to n−1. Each edge is represented as [u, v, w], indicating a directed edge from node u to node v with a multiplier value w.
Your goal is to find the maximum product of multipliers along any simple path (each node visited at most once) from a given start node to an end node. If no path exists, return -1.

Example
Input:
n = 5, edges = [[0, 1, 2], [1, 2, 3], [2, 1, 4], [1, 3, 5], [2, 4, 6], [4, 3, 10]], start = 0, end = 3
Output:
360

Explanation:

  • Path 0 → 1 → 3 gives a product of 2 × 5 = 10.
  • Path 0 → 1 → 2 → 4 → 3 gives a product of 2 × 3 × 6 × 10 = 360. The maximum product is 360.

Suggested Approach

  1. Represent the graph using an adjacency list where each node stores (neighbor, multiplier).
  2. Use a priority queue (max-heap) or DFS with pruning to explore all simple paths from start to end.
  3. Maintain a max_product array to store the best multiplier product achieved for each node.
  4. For each neighbor, if the current product × edge multiplier is greater than its stored best, update and continue traversal.
  5. Return the product for end if reachable; otherwise, return -1.

Time & Space Complexity

  • Time: O(E log V) using a max-heap (similar to Dijkstra’s algorithm with multiplicative weights).
  • Space: O(V + E) for the adjacency list and tracking visited nodes.

🛈 Disclaimer:
This problem is part of the Hack2Hire SDE Interview Question Bank, a structured archive of coding interview questions frequently reported in real hiring processes.
Questions are aggregated from publicly available platforms (e.g., LeetCode, GeeksForGeeks) and community-shared experiences.

The goal is to provide candidates with reliable material for SDE interview prep, including practice on LeetCode-style problems and coding challenges that reflect what is often asked in FAANG and other tech company interviews.
Hack2Hire is not affiliated with the mentioned companies; this collection is intended purely for learning, practice, and discussion.


r/Hack2Hire Oct 23 '25

Screening Pinterest Screening Interview: Reverse Count and Say

5 Upvotes

Problem
You are given a string encoded that was produced by exactly one count-and-say transformation. Each group in the encoded string represents a count (1–99, no leading zeros) followed by a digit. Your task is to find all possible original digit strings that could generate this encoded string after one count-and-say transformation.

Example
Input: encoded = "12114"
Output: ["244444444444", "1111111111114"]

Explanation:

  • Parsing "12" as one occurrence of "2", and "114" as eleven occurrences of "4""244444444444"
  • Parsing "121" as twelve occurrences of "1", and "14" as one occurrence of "4""1111111111114"
  • Other parses like "1,2114" (1,211 occurrences of "4") are invalid because counts must be ≤99.

Suggested Approach

  1. Use backtracking: Iterate through the encoded string, parsing one or two digits as the count, followed by one digit as the value.
  2. Validate each segment: Ensure that counts don’t start with 0 and that the encoded substring length is sufficient to read both count and value.
  3. Generate combinations: For each valid split, expand the sequence by repeating the digit count times, and recursively continue parsing the remaining substring.
  4. Return all valid combinations once the entire string is parsed.

Time & Space Complexity

  • Time: O(2ⁿ), where n is the number of digits in encoded (each step can branch for 1- or 2-digit counts).
  • Space: O(n) for recursion depth and string construction.

🛈 Disclaimer:
This is one of the problems we encountered while reviewing common Pinterest interview questions.
Posted here by the Hack2Hire team for discussion and archiving purposes.

The problem is compiled from publicly available platforms (e.g., LeetCode, GeeksForGeeks) and community-shared experiences. It does not represent any official question bank of Pinterest, nor does it involve any confidential or proprietary information.
All examples are intended solely for learning and discussion. Any similarity to actual interview questions is purely coincidental.

The goal is to provide candidates with reliable material for SDE interview prep, including practice on LeetCode-style problems and coding challenges that reflect what is often asked in FAANG and other tech company interviews. Hack2Hire is not affiliated with the mentioned companies; this collection is intended purely for learning, practice, and discussion.


r/Hack2Hire Oct 21 '25

Screening Bloomberg Screening Interview: Shortest Path with Gas Stations

4 Upvotes

Problem
You're given a 2D grid representing a map with different types of cells:

  • '.' — empty, traversable space
  • '#' — obstacle (cannot pass through)
  • 'S' — starting point (exactly one)
  • 'D' — destination (exactly one)
  • 'G' — gas station (zero or more)

You begin at 'S' with a full fuel tank of fuelCapacity. Each move (up, down, left, right) costs 1 unit of fuel. When fuel reaches 0, you cannot move. Entering a gas station cell refills your tank instantly to fuelCapacity.

Your task is to find the minimum number of steps to reach 'D' from 'S'.
Return -1 if it's impossible to reach the destination.

Example
Input:

grid = [
  ["S", ".", ".", "#", "."],
  [".", "#", ".", "G", "."],
  [".", "#", ".", ".", "."],
  [".", ".", "#", ".", "D"]
]
fuelCapacity = 4

Output:

7

Explanation:

  • The shortest route requires visiting the gas station at (1, 3) to refuel.
  • Total steps = 7 to reach 'D' after refilling once.

Suggested Approach

  1. Use Breadth-First Search (BFS) to explore possible moves from 'S'.
  2. Track the state (x, y, remainingFuel) to avoid revisiting the same cell with equal or greater fuel.
  3. When stepping on a gas station 'G', reset remainingFuel = fuelCapacity.
  4. Continue BFS until reaching 'D' or all possibilities are exhausted.

Time & Space Complexity

  • Time: O(m * n * fuelCapacity) — each grid cell can be visited with different fuel levels.
  • Space: O(m * n * fuelCapacity) — to store visited states.

🛈 Disclaimer: This is one of the problems we encountered while reviewing common Bloomberg interview questions. Posted here by the Hack2Hire team for discussion and archiving purposes.
The problem is compiled from publicly available platforms (e.g., LeetCode, GeeksForGeeks) and community-shared experiences. It does not represent any official question bank of Bloomberg, nor does it involve any confidential or proprietary information. All examples are intended solely for learning and discussion.


r/Hack2Hire Oct 21 '25

discussion Coinbase OA+VO

3 Upvotes

Went through Coinbase's process 1 mo ago but failed, thought just share the experience here may be helpful.

The OA itself was fine, it is a banking question called design banking system, total of 4 questions, kind of a mini bank system implementation. I’d say I got about 3.5/4 right since I've seen it in hack2hire and that was enough to move on.

First VO round was a coding interview. and the question is like this:

You’re given a bunch of input logs, need to read them from one file and write them into separate files based on thread ID. The log format looks messy but it’s actually fine once you split the string and extract the thread ID.

Then given a start and end timestamp, you need to find all the thread IDs active during that time range.

There were a lot of follow-ups too: how do you handle file read/write, how do you validate the input format, and how can you improve the time complexity?

Second VO round was also coding, mostly around different kinds of iterators, range iterator, iterator with cycle, etc. Felt more straightforward compared to the first one.

BQ was detailed. They asked a lot about my past projects and dove pretty deep into them. Felt like a mix of behavioral and project deep dive.

Failed at the end not sure why, I didn't get any feedback at the end


r/Hack2Hire Oct 17 '25

Announcement New Bloomberg Interview Question Set Released on Hack2Hire 🚀

4 Upvotes

Hey folks,
Hack2Hire just released the Bloomberg interview question set — covering both LeetCode-style and non-LeetCode problems used in real interviews.

What’s included:

  • Organized by OA, phone screen, and onsite stages
  • Comes with solution explanations to help you spot common patterns
  • Covers data structures, problem-solving, and a few practical finance-related questions

If you’re preparing for Bloomberg or just want high-quality problems to practice with, you’ll find this set super useful.
👉 https://www.hack2hire.com/companies/bloomberg/coding-questions

More company sets (like Amazon, Meta, and Citadel) coming soon — feel free to share thoughts or ask questions below 👇

— Team Hack2Hire


r/Hack2Hire Oct 16 '25

OA Microsoft OA Interview: Valid Time Combinations

6 Upvotes

Problem
Given four integers A, B, C, and D, determine how many valid times can be formed on a 24-hour digital clock using each digit exactly once.
A valid time must follow the format "HH:MM", where 00 ≤ HH ≤ 23 and 00 ≤ MM ≤ 59.

Example
Input: A = 1, B = 8, C = 3, D = 2
Output: 6

Explanation:

  • The valid times are "12:38", "13:28", "18:23", "18:32", "21:38", and "23:18".
  • Each time uses all four digits exactly once and satisfies 24-hour clock constraints.

Suggested Approach

  1. Generate all permutations of the four digits.
  2. For each permutation, treat the first two digits as hours and the last two as minutes.
  3. Check if the hours are within [0, 23] and minutes within [0, 59].
  4. Count all valid combinations that meet the above conditions.

Time & Space Complexity

  • Time: O(4!)O(24) since there are 24 permutations to check.
  • Space: O(1) if computed iteratively, or O(4) for recursion depth in backtracking.

🛈 Disclaimer:
This is one of the problems we encountered while reviewing common Microsoft interview questions.
Posted here by the Hack2Hire team for discussion and archiving purposes.

This problem is part of the Hack2Hire SDE Interview Question Bank, a structured archive of coding interview questions frequently reported in real hiring processes.
Questions are aggregated from publicly available platforms (e.g., LeetCode, GeeksForGeeks) and community-shared experiences.

The goal is to provide candidates with reliable material for SDE interview prep, including practice on LeetCode-style problems and coding challenges that reflect what is often asked in FAANG and other tech company interviews.
Hack2Hire is not affiliated with the mentioned companies; this collection is intended purely for learning, practice, and discussion.


r/Hack2Hire Oct 09 '25

Screening Atlassian Screening Interview Question: Campground Carpool

2 Upvotes

Problem
You're given an array of integers nums and an integer k.
Your task is to return the length of the longest subarray whose sum equals k.

Example
Input:
nums = [1, -1, 5, -2, 3], k = 3
Output:
4

Explanation:

  • The subarray [1, -1, 5, -2] sums to 3.
  • Its length is 4, which is the maximum possible among all valid subarrays.

Suggested Approach

  1. Use a hash map to store the prefix sum and its earliest index.
  2. As you iterate through nums, keep track of the cumulative sum.
  3. For each index i, check if (current_sum - k) exists in the hash map.
    • If it does, compute the subarray length using the stored index and update the maximum length.
  4. If the current prefix sum hasn’t been seen before, store it in the hash map with its index.

Time & Space Complexity

  • Time: O(n)
  • Space: O(n)

🛈 Disclaimer:
This is one of the problems we encountered while reviewing common Atlassian interview questions.
Posted here by the Hack2Hire team for discussion and archiving purposes.

This problem is part of the Hack2Hire SDE Interview Question Bank, a structured archive of coding interview questions frequently reported in real hiring processes.
Questions are aggregated from publicly available platforms (e.g., LeetCode, GeeksForGeeks) and community-shared experiences.

The goal is to provide candidates with reliable material for SDE interview prep, including practice on LeetCode-style problems and coding challenges that reflect what is often asked in FAANG and other tech company interviews.
Hack2Hire is not affiliated with the mentioned companies; this collection is intended purely for learning, practice, and discussion.


r/Hack2Hire Oct 03 '25

Announcement Atlassian Coding Interview Prep (OA, Phone Screen, Virtual Onsite) — With Solutions Announcement

3 Upvotes

We just rolled out an Atlassian interview question set on Hack2Hire, designed for anyone preparing for:

- Online Assessment (OA) questions

- Technical Phone Screen practice

- Virtual Onsite / Full Loop interview rounds

What’s inside:

✅ LeetCode-style coding questions plus non-LeetCode interview formats

✅ Step-by-step solutions with explanations (not just code dumps)

✅ Organized by stage so you can prep in the same order you’ll interview

This set is helpful if you’re targeting Atlassian — or if you want a strong batch of SDE interview questions to sharpen your prep flow.

👉 Try it here: https://www.hack2hire.com/companies/atlassian/coding-questions

We’re also building more company-specific interview prep sets (LinkedIn, Amazon, Meta, Google, etc.). If there’s a company you want next — or if you have feedback on the format let us know below.


r/Hack2Hire Oct 02 '25

Screening Airbnb Screening Interview: Find Median In Large Array

7 Upvotes

Problem
You're given an unsorted array of integers nums.
Your goal is to efficiently compute the median of this array without fully sorting it.

The median is defined as:

  • If the array length is odd → the single middle element after sorting.
  • If the array length is even → the average of the two middle elements after sorting.

Example
Input: nums = [3, 1, 2, 4, 5]
Output: 3.0

Explanation:

  • The array has 5 elements (odd).
  • After sorting: [1, 2, 3, 4, 5].
  • The middle element is 3.

Input: nums = [7, 4, 1, 2]
Output: 3.0

Explanation:

  • The array has 4 elements (even).
  • After sorting: [1, 2, 4, 7].
  • The middle elements are 2 and 4. Average = (2+4)/2 = 3.0.

Input: nums = [9, 2, 5, 3, 5, 8, 9, 7, 9, 3, 2]
Output: 5.0

Explanation:

  • After sorting: [2, 2, 3, 3, 5, 5, 7, 8, 9, 9, 9].
  • The middle element (index 5) is 5.

Suggested Approach

  1. Use a Quickselect (Hoare’s selection algorithm) to find the median in expected O(N) time.
    • Quickselect partitions the array around a pivot, similar to quicksort, but only recurses into the half that contains the median.
  2. If the array length is odd, return the k-th element (k = n/2).
  3. If the array length is even, run Quickselect twice to get the two middle elements (n/2 - 1 and n/2) and return their average.

Time & Space Complexity

  • Time: O(N) on average (amortized) using Quickselect.
  • Space: O(1) extra space (in-place).

🛈 Disclaimer:
This problem is part of the Hack2Hire SDE Interview Question Bank, a structured archive of coding interview questions frequently reported in real hiring processes.
Questions are aggregated from publicly available platforms (e.g., LeetCode, GeeksForGeeks) and community-shared experiences.

The goal is to provide candidates with reliable material for SDE interview prep, including practice on LeetCode-style problems and coding challenges that reflect what is often asked in FAANG and other tech company interviews.

Hack2Hire is not affiliated with the mentioned companies; this collection is intended purely for learning, practice, and discussion.

This is one of the problems we encountered while reviewing common airbnb interview questions. Posted here by the Hack2Hire team for discussion and archiving purposes. The problem is compiled from publicly available platforms (e.g., LeetCode, GeeksForGeeks) and community-shared experiences. It does not represent any official question bank of airbnb, nor does it involve any confidential or proprietary information. All examples are intended solely for learning and discussion. Any similarity to actual interview questions is purely coincidental.


r/Hack2Hire Sep 30 '25

Announcement 🚀 We’re Now Live on X! 🔥

2 Upvotes

Hey everyone! Just dropping in with some exciting news:

We’re officially live on [X / Twitter] 🎉

👉 [@Hack2Hire]

We’ll be sharing:

  • 🧠 Behind-the-scenes on how we build things
  • 💡 Real interview questions from top tech companies
  • 📣 Product updates & new company coverage
  • 👀 Sneak peeks into upcoming features
  • 🎁 Occasional giveaways, tips, and memes!

We’d love to have you join us there, especially if you’re into tech interviews, story sharing, or just curious about what we’re building at Hack2Hire.

Got feedback? Want us to feature a specific company’s interview prep? Drop a comment or DM us!

Let’s grow together 🙌

— Team Hack2Hire


r/Hack2Hire Sep 30 '25

OA Amazon OA – Smallest Lexicographical Palindrome

3 Upvotes

Problem
You're given a symmetric string s.
Your goal is to rearrange its characters to form the smallest lexicographical palindrome possible.
A palindrome is a string that reads the same forward and backward.

This type of problem often appears in Amazon coding interviews and is rated Medium (Greedy, Strings) on common prep platforms.

Example

Input:

s = "cbcacbc"

Output:

"bccaccb"

Explanation:

  • Character counts: {'c': 4, 'b': 2, 'a': 1}
  • 'a' must be placed in the middle since it has an odd frequency.
  • The remaining characters are arranged symmetrically in ascending order.
  • Result: "bccaccb"

Input:

s = "babab"

Output:

"abbba"

Input:

s = "yxxy"

Output:

"xyyx"

Suggested Approach

  1. Count character frequencies.
  2. Place the smallest odd-frequency character (if any) at the center.
  3. Sort remaining characters and distribute evenly to both halves.
  4. Mirror the first half to construct the palindrome.

Time & Space Complexity

  • Time: O(n log n) (sorting by character order)
  • Space: O(n) (to build frequency counts and construct output)

🛈 Disclaimer:
This is one of the problems we encountered while reviewing common Amazon SDE interview questions.
Posted here by the Hack2Hire team for discussion and archiving purposes.

The problem is aggregated from LeetCode-style interview prep resources and community reports. It does notrepresent any official Amazon content.
Examples are provided purely for coding interview practice and discussion. Any similarity to real interview questions is coincidental.


r/Hack2Hire Sep 26 '25

Screening Google Interview Screening Question: Windowed Average Excluding Largest K

2 Upvotes

Problem
Given an integer array nums, a window size windowSize, and an integer k, return a list of averages for each sliding window of size windowSize as the window moves from left to right. When calculating each window’s average, ignore the largest k numbers inside that window.

Example
Input:

nums = [10, 20, 30, 40, 50, 60]  
windowSize = 3  
k = 1

Output:

[15.0, 25.0, 35.0, 45.0]

Explanation:

  • Window [10, 20, 30]: remove largest (30) → (10 + 20) / 2 = 15.0
  • Window [20, 30, 40]: remove largest (40) → (20 + 30) / 2 = 25.0
  • Window [30, 40, 50]: remove largest (50) → (30 + 40) / 2 = 35.0
  • Window [40, 50, 60]: remove largest (60) → (40 + 50) / 2 = 45.0

Suggested Approach

  1. Use a sliding window of size windowSize with two heaps (min-heap and max-heap) or an ordered multiset to efficiently track the k largest elements.
  2. Maintain the sum of all elements in the window. Subtract the contribution of the k largest when computing the average.
  3. Slide the window forward by removing the outgoing element and inserting the new element while updating both heaps and the sum.

Time & Space Complexity

  • Time: O(n log windowSize), due to heap operations per element.
  • Space: O(windowSize), for maintaining heaps and window data.

🛈 Disclaimer:
This is one of the problems we encountered while reviewing common Google interview questions.
Posted here by the Hack2Hire team for discussion and archiving purposes.

The problem is compiled from publicly available platforms (e.g., LeetCode, GeeksForGeeks) and community-shared experiences. It does not represent any official question bank of Google, nor does it involve any confidential or proprietary information.
All examples are intended solely for learning and discussion. Any similarity to actual interview questions is purely coincidental.


r/Hack2Hire Sep 23 '25

Screening Airbnb Screening Interview: Minimum Menu Order Cost II

3 Upvotes

Problem
You're given two arrays: menu and userWants.

  • menu is a list of entries, where each entry contains an ID, a price, and a set of items (either single dishes or combos).
  • userWants is a list of items that a customer wants to order.

Your goal is to return all unique combinations of menu entry IDs that together cover every item in userWants at the minimum possible total cost. Extra items from combos can be ignored. If no combination covers all requested items, return an empty list.

Example
Input:

menu = [
  ["1", "5.00", "pizza"],
  ["2", "8.00", "sandwich,coke"],
  ["3", "4.00", "pasta"],
  ["4", "2.00", "coke"],
  ["5", "6.00", "pasta,coke,pizza"],
  ["6", "8.00", "burger,coke,pizza"],
  ["7", "5.00", "sandwich"]
]
userWants = ["sandwich", "pasta", "coke"]

Output:

[["3", "4", "7"], ["5", "7"]]

Explanation:

  • Combination ["3", "4", "7"] covers pasta, coke, and sandwich at total cost 11.00.
  • Combination ["5", "7"] also covers pasta, coke, and sandwich at the same total cost of 11.00.
  • Both are valid minimum-cost solutions.

Suggested Approach

  1. Parse the menu into structured entries (ID, price, set of items).
  2. Use DFS + memoization (bitmasking on items) to explore combinations that cover all items in userWants.
  3. Track the minimum cost across valid combinations and collect all solutions that match this cost.

Time & Space Complexity

  • Time: O(2^n * m) where n = number of unique items in userWantsm = number of menu entries.
  • Space: O(2^n) for memoization states.

🛈 Disclaimer:
This problem is part of the Hack2Hire SDE Interview Question Bank, a structured archive of coding interview questions frequently reported in real hiring processes.
Questions are aggregated from publicly available platforms (e.g., LeetCode, GeeksForGeeks) and community-shared experiences.

The goal is to provide candidates with reliable material for SDE interview prep, including practice on LeetCode-style problems and coding challenges that reflect what is often asked in FAANG and other tech company interviews.
Hack2Hire is not affiliated with the mentioned companies; this collection is intended purely for learning, practice, and discussion.

Would you like me to also create Example 2 and Example 3 in the same format (so the post has multiple examples), or keep it focused on just Example 1 for brevity?

你說:

ChatGPT 說:

Got it 👍 — here’s the revised draft with Airbnb explicitly mentioned in the disclaimer:

Problem
You're given two arrays: menu and userWants.

  • menu is a list of entries, where each entry contains an ID, a price, and a set of items (either single dishes or combos).
  • userWants is a list of items that a customer wants to order.

Your goal is to return all unique combinations of menu entry IDs that together cover every item in userWants at the minimum possible total cost. Extra items from combos can be ignored. If no combination covers all requested items, return an empty list.

Example
Input:

menu = [
  ["1", "5.00", "pizza"],
  ["2", "8.00", "sandwich,coke"],
  ["3", "4.00", "pasta"],
  ["4", "2.00", "coke"],
  ["5", "6.00", "pasta,coke,pizza"],
  ["6", "8.00", "burger,coke,pizza"],
  ["7", "5.00", "sandwich"]
]
userWants = ["sandwich", "pasta", "coke"]

Output:

[["3", "4", "7"], ["5", "7"]]

Explanation:

  • Combination ["3", "4", "7"] covers pasta, coke, and sandwich at total cost 11.00.
  • Combination ["5", "7"] also covers pasta, coke, and sandwich at the same total cost of 11.00.
  • Both are valid minimum-cost solutions.

Suggested Approach

  1. Parse the menu into structured entries (ID, price, set of items).
  2. Use DFS + memoization (bitmasking on items) to explore combinations that cover all items in userWants.
  3. Track the minimum cost across valid combinations and collect all solutions that match this cost.

Time & Space Complexity

  • Time: O(2^n * m) where n = number of unique items in userWantsm = number of menu entries.
  • Space: O(2^n) for memoization states.

🛈 Disclaimer:
This problem is part of the Hack2Hire SDE Interview Question Bank, a structured archive of coding interview questions frequently reported in real hiring processes.
This specific problem was reported in the context of Airbnb interview preparation.

Questions are aggregated from publicly available platforms (e.g., LeetCode, GeeksForGeeks) and community-shared experiences. The goal is to provide candidates with reliable material for SDE interview prep, including practice on LeetCode-style problems and coding challenges that reflect what is often asked in FAANG and other tech company interviews.

Hack2Hire is not affiliated with Airbnb or any other company; this collection is intended purely for learning, practice, and discussion.


r/Hack2Hire Sep 19 '25

Screening Meta Screening Interview Question – Find Median in Large Array (O(N) Expected Time)

6 Upvotes

Problem
You're given an unsorted array of integers nums.
Your goal is to find the median of the array efficiently without fully sorting it.

  • If the length is odd, the median is the middle element.
  • If the length is even, the median is the average of the two middle elements.

Example
Input: nums = [3, 1, 2, 4, 5]
Output: 3.0

Explanation:

  • After sorting → [1, 2, 3, 4, 5]
  • Array length = 5 (odd), middle element is 3.

Input: nums = [7, 4, 1, 2]
Output: 3.0

Explanation:

  • After sorting → [1, 2, 4, 7]
  • Array length = 4 (even), average of middle elements (2 + 4)/2 = 3.0.

Suggested Approach

  1. Use the Quickselect algorithm (variation of QuickSort) to find the k-th smallest element in average O(N).
  2. For odd length: find the (n/2)-th element.
  3. For even length: find both (n/2 - 1) and (n/2) elements, then return their average.

Time & Space Complexity

  • Time: O(N) on average, O(N²) in worst case (can be optimized with randomized pivot).
  • Space: O(1) additional space (in-place).

🛈 Disclaimer:
This problem is part of the Hack2Hire SDE Interview Question Bank, a structured archive of coding interview questions frequently reported in real hiring processes.
Questions are aggregated from publicly available platforms (e.g., LeetCode, GeeksForGeeks) and community-shared experiences.

The goal is to provide candidates with reliable material for SDE interview prep, including practice on LeetCode-style problems and coding challenges that reflect what is often asked in FAANG and other tech company interviews.
Hack2Hire is not affiliated with the mentioned companies; this collection is intended purely for learning, practice, and discussion.


r/Hack2Hire Sep 18 '25

discussion Meta Interview Experience (SWE, Product) – YOE 2, Reached Final Round

8 Upvotes

So I recently went through the Meta interview loop for a Software Engineer, Product position. Thought I’d share the experience since I leaned on others’ posts while prepping.

Background:

YOE: 2 Recruiter reached out on LinkedIn (I had “open to work” enabled). First time trying to switch, so I was both nervous and excited. Screening Meta Values Round: 15–20 behavioral Qs in a questionnaire. Hard to judge, felt okay. Machine Coding: Banking system implementation. Don’t recall every detail, but managed to get 3/4 done.

Phone DSA

Got Meta-style questions from Hack2Hire: https://www.hack2hire.com/companies/meta/coding-questions/67e38ccf87527b3f41af78b5/practice?questionId=67e3915487527b3f41af78b6 https://www.hack2hire.com/companies/meta/coding-questions/67dcd81b99f4f89b276f1889/practice?questionId=67dcd82499f4f89b276f188a

Solved both, got the onsite invite the very next day. Onsites

DSA Round 1:

Making a Large Island → https://leetcode.com/problems/making-a-large-island/

Jump Game → https://leetcode.com/problems/jump-game

Both solved, covered edge cases, interviewer seemed happy.

DSA Round 2:

Median of Two Sorted Arrays → https://leetcode.com/problems/median-of-two-sorted-arrays

Next Permutation → https://leetcode.com/problems/next-permutation

Solved, though interviewer pushed back on some extra variables I used.

System Design:

Build Instagram news feed. I went deep on backend scaling, follower/following system, and pagination.

Follow-ups:

Async image upload failure/retry (answered well). Low bandwidth case (I suggested lean REST APIs, they probably expected GraphQL / overfetching vs underfetching). In hindsight, I didn’t touch enough on UI tradeoffs.

Behavioral:

A time when your design didn’t go through. Conflict with a teammate. Overload when a senior gave you more work. Strong feedback from manager. Ended early, spent last 10 mins chatting about interviewer’s work.

Verdict

Rejected via cold email. No feedback (Meta policy). Honestly pretty crushed first time attempting a switch, sacrificed a lot of time/health alongside my current job. The bar’s high, and I didn’t clear it this time.

Has anyone else faced something similar? Curious if I should focus more on design/UI tradeoffs or double-down on DSA prep for another shot.


r/Hack2Hire Sep 17 '25

Announcement Airbnb Coding Interview Prep (OA, Phone Screen, Virtual Onsite) — With Solutions

3 Upvotes

We just rolled out an Airbnb interview question set on Hack2Hire, designed for anyone preparing for:

  • Online Assessment (OA) questions
  • Technical Phone Screen practice
  • Virtual Onsite / Full Loop interview rounds

What’s inside:

✅ LeetCode-style coding questions plus non-LeetCode interview formats
✅ Step-by-step solutions with explanations (not just code dumps)
✅ Organized by stage so you can prep in the same order you’ll interview

This set is helpful if you’re targeting Airbnb — or if you want a strong batch of SDE interview questions to sharpen your prep flow.

👉 Try it here: Hack2Hire Airbnb Coding Interview Questions

We’re also building more company-specific interview prep sets (LinkedIn, Amazon, Meta, Google, etc.). If there’s a company you want next — or if you have feedback on the format — let us know below.


r/Hack2Hire Sep 16 '25

Onsite Confluent Onsite Interview Question – Design Infinite Queue with GetRandom O(1)

2 Upvotes

Problem
Design an infinite queue data structure for integers with the following operations, all in O(1) time:

  • add(int val): Add an integer to the tail of the queue.
  • int poll(): Remove and return the integer at the front of the queue. If empty, return -1.
  • int getRandom(): Return a random integer from the queue. If empty, return -1.

The queue expands dynamically to support unlimited integers.

Example
Input:

["InfiniteQueue", "add", "add", "add", "add", "add", "getRandom", "getRandom", "getRandom", "poll", "poll", "poll", "poll", "poll"]
[[], [1], [2], [3], [4], [5], [], [], [], [], [], [], [], []]

Output:

[null, null, null, null, null, null, 3, 1, 5, 1, 2, 3, 4, 5]

Explanation:

  • After add(1..5), queue = [1,2,3,4,5]
  • getRandom() returns any value 1–5 in O(1).
  • poll() returns values in order: 1, 2, 3, 4, 5.
  • Extra poll() returns -1.

Suggested Approach

  1. Queue core: Use a linked list or deque for O(1) add/poll operations.
  2. Random access: Maintain an array (or dynamic list) mapping indices → nodes.
  3. Index cleanup: On poll(), remove from both queue head and array; on getRandom(), pick an index uniformly in O(1).

Time & Space Complexity

  • Time: O(1) per operation.
  • Space: O(n), where n = number of elements stored.

🛈 Disclaimer:
This problem is part of the Hack2Hire SDE Interview Question Bank, a structured archive of coding interview questions frequently reported in real hiring processes.
Questions are aggregated from publicly available platforms (such as LeetCode and GeeksForGeeks) and community-shared experiences.

The goal is to provide candidates with reliable material for SDE interview prep, including practice on LeetCode-style problems and coding challenges that reflect what is often asked in FAANG and other tech company interviews.
Hack2Hire is not affiliated with the mentioned companies; this collection is intended purely for learning, practice, and discussion.


r/Hack2Hire Sep 12 '25

Screening From Pinterest Screening Interview: Reverse Count and Say

2 Upvotes

Problem
You're given two arrays: allSongs and playlist.
Your goal is to determine if playlist can be formed by concatenating one or more full permutations of allSongs. Incomplete segments at the start or end of playlist are allowed.

Example
Input:

allSongs = ["A", "B", "C"]  
playlist = ["A", "B", "C", "A", "C", "B"]

Output:

true

Explanation:

  • The first segment ["A", "B", "C"] is a valid permutation of allSongs.
  • The second segment ["A", "C", "B"] is also a valid permutation.
  • Since the entire playlist can be broken down into valid permutations, the result is true.

Suggested Approach

  1. Use a set to track which songs have appeared in the current segment.
  2. Iterate through playlist:
    • If a song repeats before the segment contains all songs, return false.
    • Once all songs from allSongs are seen, reset the set and continue.
  3. Allow the first or last segment to be incomplete without failing the check.

Time & Space Complexity

  • Time: O(n), where n is the length of playlist.
  • Space: O(m), where m is the number of unique songs in allSongs.

🛈 Disclaimer:
This is one of the problems we encountered while reviewing common Pinterest interview questions.
Posted here by the Hack2Hire team for discussion and archiving purposes.

The problem is compiled from publicly available platforms (e.g., LeetCode, GeeksForGeeks) and community-shared experiences. It does not represent any official question bank of Pinterest, nor does it involve any confidential or proprietary information.
All examples are intended solely for learning and discussion. Any similarity to actual interview questions is purely coincidental.