Inteview Preparation

Interview Preparation

LeetCode Problems:

Arrays & Strings

Boats to Save PeopleLinkMediumSort the list and check elements from the beginning and end
Container with Most WaterLinkMediumFinding max area by checking elements from two sides of array. max(temp,max_area). If height[left] < height [right] increase left
Find First and Last Position of Element in Sorted ArrayLinkMediumWrite two functions one for finding first pos, other one is for finding last pos. Use binary search
First Bad VersionLinkEasySorted array find value just like binary search
Longest Substring without Repeating ElementsLinkMediumUse two pointers and dict
Move ZeroesLinkEasyTwo for loops; one of them is for overwriting all elements by non-zero elements, the other one is for adding zeroes

Linked Lists

Add Two NumbersLinkMediumEstimate depth, calculate number itself, sum them up, return -1. Use carry approach simple, easy. My explanation on Leetcode
Linked List CycleLinkEasyInitialize two pointers, move one of them by 1, other one by 2. If there is a cycle, eventually those two pointers show the same value. Tortoise & Hare, Floyd’s algorithm My explanation on Leetcode
Merge Two Sorted ListsLinkEasyCompare two elements at the same time, add rest of them
Reverse Linked ListLinkEasyUtilize iteration method to reverse linked list. Use three pointers prev,head and next and change head’s next position to prev and update each element’s place.


4Sum IILinkMediumThe first two elements’ sum must equal to (-1) of last two elements’ sum
Contains DuplicateLinkEasySets. My explanation on Leetcode
Group AnagramsLinkMediumSort strings and use them as keys
LRU CacheLinkHardUse Deque and Map to find solution
Majority ElementLinkEasyCount the occurrence of items solve the question
Two SumLinkMediumUse remaining number as a key. If you need to have 9, check remaining values 7,5,3 for 2,4,6 respectively. If you find the same remaining value in your list, you are done.


Add BinaryLinkMediumCheck binary rules
Count PrimesLinkEasyBoolean array, iterate 2..sqrt(2) and set n*n
Missing NumberLinkEasy(n * (n + 1))/ 2
Robot Return to OriginLinkEasyCalculate X & Y coordinate seperately
Single NumberLinkEasyUse sets, subtract 2*(set_version) from original one


Algorithm Training Beginner Set [Official solutions]

Problem & Solution
Easy Magic Trick
Ice Cream Yum Yum
Harun & Sami
Meme Man
Merge Sort
Stringer Things
Usain Bolt
The Pit

Data Structures

Doubly Linked ListLinkNext and previous
Singly Linked ListLinkOnly next Insertion & Deletion O(1)


Binary SearchLinkMust be sorted, Divide the array by 2 and iterate
Sliding WindowLink
Deniz Karakay
Deniz Karakay
Electrical Electronics Engineering Student

My research interests include distributed robotics, mobile computing and programmable matter.