/Sample_Problems

Just practicing some coding interview questions.

Primary LanguageC++

Sample Problems

I'm just practicing some sample problems from Cracking the Coding Interview, Elements of Programming Interviews, etc.

addOne.cpp

Given a number represented as an array of numbers 0-9, add one to that number.

For example: [2,0,9] => [2,1,0] or [9,9] => [1,0,0]

biggestBlock.cpp

Find the size of the largest connected network in a M x N matrix.

binSearchRotatedArray.cpp

Use binary search to find an integer in a circular sorted list of integers where the start of the list is unknown.

For example: find 3 in the following list using binary search: [6,7,8,9,0,1,2,3,4,5]

crossword.cpp

Determine if a grid of black and white squares (2D array of 0's and 1's) is a valid crossword puzzle (i.e. if all of the white squares are connected).

linkedListPalindrome.cpp

Determine if the given linked list is a palindrome.

maxSubarraySum

Of all the possible subarrays in a given array, find the one with the largest sum. Return that sum.

parser.cpp

Make a csv parser where a row and column delimiter is given with an input string and a 2D array is returned.

If there are quotation marks, ignore any delimiters inside the quotation marks.

sayTheNumber.cpp

Given an integer, output the english version of the number.

For example: -10,234 would be negative ten thousand two hundred thirty four.

stackMinClass.cpp

Design a stack that has the ability to find the minimum in O(1) time.

ticTacToe.cpp

Devise a representation of an NxN tic-tac-toe game board, with the variation you only need M tokens in a row to win (in any direction), such that a win can be verified in O(1) time.