Weed Out Questions Flashcards
Find Second Highest Salary (SQL)
SELECT MAX(Salary) From Employee where Salary Not In (SELECT MAX(Salary From Employee
Difference between GET and POST (HTTP)
GET retrieves data from the server and POST creates/updates. POST is different that PUT in that calling POST multiple times creates multiple instances of same data. GET is in URL, POST is in HTML Forms
Difference between a Class and an object
Class defines the structure, methods, initial values etc. and an object is an instance of a class
FizzBuzz
1-100, multiples of 3: “Fizz”, multiples of 5: “Buzz”, multiples of 3 and 5 “FizzBuzz”
Fibonocci Sequence in different optimization iterations
Brute force, Recursion, Dynamic Programming, Store last two numbers
Add, Remove, Insert elements from a LinkedList
<code></code>
Find the middle element of a linked list in one pass
Maintain two pointers with one increment by two and the other by one
Find the kth element in one pass
Two pointers, when one reaches the kth element, start the other
In an integer array 1 to 100 find the duplicate number
Total sum should be equal to n(n+1)/2 so simply subtract actual sum from expected sum
Reverse a string
<code></code>
Sort an array with bubble sort
<code></code>
Difference between stack and queue
LIFO, FIFO
Find duplicates in an array if there are more than one duplicate
Store each element in a hashmap as a key with the number of occurrences as a value
Difference between singly and doubly linked list
Singly linked has one pointer to the next node, doubly has two pointers
Check if a number is a palindrome
For reference: 1234/10 will give you 123 and 1234%10 will return 4