Skip to content

Latest commit

 

History

History
42 lines (29 loc) · 2.21 KB

README.md

File metadata and controls

42 lines (29 loc) · 2.21 KB

Technical Interview Practice

This includes any resources that CoSMO provides for its weekly technical interview practice questions.

Weekly technical questions:

2019-09-08: Given two strings, write a method to decide if one is a permutation of the other.

2019-09-15: Given two arrays of integers, find a pair of values (one value from each array) that you can swap to give the two arrays the same sum. EXAMPLE Input: [4, 1, 2, 1, 1, 2] and [3, 6, 3, 3] Output: [1, 3]

2019-09-22: Given an array of 10,000 integers, find the k greatest elements. (Bonus points if you do it without sorting the array!)

2019-09-29: Write a program to sort a stack such that the smallest items are on the top. You can use an additional temporary stack, but you may not copy the elements into any other data structure (such as an array). The stack supports the following operations: push, pop, peek, and isEmpty.

2019-10-06: A child is running up a staircase with n steps and can hop either 1 step, 2 steps, or 3 steps at a time. Implement a method to count how many possible ways the child can run up the stairs.

2019-10-13: Write an algorithm which computes the number of trailing zeros in n factorial runtime.

2019-10-20: A magic index in an array A[1 ... n-1] is defined to be an index such that A[i] = i. Given a sorted array of distinct integers, write a method to find a magic index, if one exists, in array A.

2019-10-27: Given an array N of numbers and constant K, find the contiguous subarray of N which has the largest sum. Ex. [1, 2, 3, 4, 5], 3 → [3, 4, 5]

2019-11-03: Write a method to compute all permutations of a string of unique characters.

2019-11-10: Given two arrays of integers, compute the pair of values (one value in each array) with the smallest (non-negative) difference. Return the difference. Ex. Input: {l, 3, 15, 11, 2}, {23, 127, 235, 19, 8} Output: 3. That is, the pair (11, 8).

2019-11-17: Given a linked list, remove the n-th node from the end of list and return its head. Example: Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from the end, the linked list becomes 1->2->3->5. Definition for singly-linked list class ListNode: def init(self, x): self.val = x self.next = None