Share this publication

SWE Prep

sweprep.substack.com

Interview questions straight to your inbox.Your guide for nailing the technical interview

Share this post Interview questions straight to your inbox. sweprep.substack.com |

Invert Binary TreeQuestion: Invert a binary tree. Input: 4 / \ 2 7 / \ / \ 1 3 6 9 Output: 4 / \ 7 2 / \ / \ 9 6 3 1 Solution Approach 1: Recursive The inverse of an emp…

Share this post Invert Binary Tree sweprep.substack.com |

Divisor GameAlice and Bob take turns playing a game, with Alice starting first. Initially, there is a number N on the chalkboard. On each player's turn, that playe…

Share this post Divisor Game sweprep.substack.com |

Single NumberQuestion: Given a non-empty array of integers nums, every element appears twice except for one. Find that single one. Solution Approach 1: Hash Table W…

Share this post Single Number sweprep.substack.com |

Smallest RangeGiven an array A of integers, for each integer A[i] we may choose any x with -K <= x <= K, and add x to A[i]. After this process, we have some array B.…

Share this post Smallest Range sweprep.substack.com |

Find the Distance Value Between Two ArraysLessons Learned: TreeSet, Array Manipulation

Share this post Find the Distance Value Between Two Arrays sweprep.substack.com |

Valid ParenthesesQuestion: Implement an algorithm to print all valid (properly opened and closed) combinations of n pairs of parentheses.

Share this post Valid Parentheses II sweprep.substack.com |

Publish on Substack

SWE Prep is on Substack – the place for independent writing