Skip to content

Instantly share code, notes, and snippets.

View charlespunk's full-sized avatar

charlespunk charlespunk

View GitHub Profile
You have a stack of n boxes, with widths wi, height hi, and depths di. The boxes cannot be rotated and can only be stacked on top of one another if each box in the stack is strictly larger than the box above it in width, height and depth. Implemnt a method to build the tallest stack possible, where the height of a stack is the sum of the heights of each box.
Given a boolean expression consisting of the symbols 0, 1, &, |, and ^, and a desired boolean result value result, implement a function to count the number of ways of parenthesizing the expression such that it evaluates to result.
Example: (1^0|0|1, true)
1. Heapsort
2. Mergesort
3. Quicksort
You are given two sorted arrays, A and B, where A has a large enough buffer at the end to hold B. Write a method to merge B into A in sorted order.
1 5 8 9
2 6 8 10
Write a methos to sort an array of strings so that all the anagrams are next to each other.
Given a sorted array of strings which is interepersed with empty strings, write a method to find the location of a given string.
Find the biggest sum of a sequent integers.
For example:
[4 3 -2 1 -8 10 2 -3 -1]
The giggest sequence is "10 2" => 12.
____ ____
| |___| |
|__|___|___|_
Several rectangles range along a line. Reruen the outline of rectangles.
Given a M*N matrix, if matrix[i][j] == 0, set all the elements in row i and column j to '0'.
When you could not use other buffer.
When this is a 3D matrix or nD matrix.
command line:
run.exe cat "big dog" fish the"symbol monkey
return:
1. run.exe
2. cat
3. big dog
4. fish
5. the"symbol
6. monkey