0%

Valid Parentheses – LeetCode 20

Problem

Description

Given a string containing just the characters ‘(‘, ‘)’, ‘{‘, ‘}’, ‘[‘ and ‘]’, determine if the input string is valid.

The brackets must close in the correct order, “()” and “()[]{}” are all valid but “(]” and “([)]” are not.

Read more »

Longest Common Prefix – LeetCode 14

Problem

Description

Write a function to find the longest common prefix string amongst an array of strings.

Read more »

Roman to Integer – LeetCode 13

Problem

Description

Given a roman numeral, convert it to an integer.

Input is guaranteed to be within the range from 1 to 3999.

Read more »

Palindrome Number – LeetCode 9

Problem

Description

Determine whether an integer is a palindrome. Do this without extra space.

Some hints:
Could negative integers be palindromes? (ie, -1)

If you are thinking of converting the integer to string, note the restriction of using extra space.

You could also try reversing an integer. However, if you have solved the problem “Reverse Integer”, you know that the reversed integer might overflow. How would you handle such case?

There is a more generic way of solving this problem.

Read more »

Reverse Integer – LeetCode 7

Problem

Description

Reverse digits of an integer.

Read more »

Two Sum – LeetCode 1

Problem

Description

Given an array of integers, return indices of the two numbers such that they add up to a specific target.
You may assume that each input would have exactly one solution, and you may not use the same element twice.

Read more »