Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.

This is tough as a line can have slope. My solution is O(n^2):

Read More

Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.

This is tough as a line can have slope. My solution is O(n^2):

Read More

j j j

Evaluate the value of an arithmetic expression in Reverse Polish Notation.

Valid operators are

+ - * /

. Each operand may be an integer or another expression.

Some examples:

["2", "1", "+", "3", "*"] -> ((2 + 1) * 3) -> 9 ["4", "13", "5", "/", "+"] -> (4 + (13 / 5)) -> 6

My codes:

Read More

j j j

Given an input string, reverse the string word by word.

For example,

Given s = “the sky is blue”,

return “blue is sky the”.

My codes:

j j j