036 Valid Sukodu

Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.

The Sudoku board could be partially filled, where empty cells are filled with the character '.'.

阅读更多

035 Search Insert Position

Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.

阅读更多

028 Implement strStr

Implement strStr().

Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.

阅读更多

024 Swap Nodes in Pairs

Given a linked list, swap every two adjacent nodes and return its head.

For example,
Given 1->2->3->4, you should return the list as 2->1->4->3.

阅读更多

020 Valid Parentheses

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

The brackets must close in the correct order.

阅读更多

019 Remove Nth Node From End of List

Given a linked list, remove the nth node from the end of list and return its head. Given n will always be valid and try to do this in one pass.

For example,

1
2
3
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.

阅读更多

014 Longest Common Prefix

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

阅读更多

009 Palindrome Number

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

阅读更多

008 String to Integer (atoi)

Implement atoi to convert a string to an integer.

阅读更多

007 Reverse Integer

Reverse digits of an integer.

Example1: x = 123, return 321
Example2: x = -123, return -321

阅读更多