# LeetCode 37. Sudoku Solver

Sudoku Solver

## Description

Write a program to solve a Sudoku puzzle by filling the empty cells. Empty cells are indicated by the character ‘.'. You may assume that there will be only one unique solution.

# LeetCode 10. Regular Expression Matching

Regular Expression Matching

## Description

Implement regular expression matching with support for ‘.’ and ‘*'.

``````'.' Matches any single character.
'*' Matches zero or more of the preceding element.

The matching should cover the entire input string (not partial).

The function prototype should be:
bool isMatch(const char *s, const char *p)

Some examples:
isMatch("aa","a") → false
isMatch("aa","aa") → true
isMatch("aaa","aa") → false
isMatch("aa", "a*") → true
isMatch("aa", ".*") → true
isMatch("ab", ".*") → true
isMatch("aab", "c*a*b") → true
``````

# LeetCode 9. Palindrome Number

Palindrome Number

## Description

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

# LeetCode 8. String to Integer (atoi)

String to Integer (atoi)

## Description

Implement atoi to convert a string to an integer. Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the > possible input cases. Notes: It is intended for this problem to be specified vaguely (ie, no given input specs). You are responsible to gather all the > input requirements up front.

# LeetCode 7. Reverse Integer

Reverse Integer

## Description

Reverse digits of an integer. `Example1: x = 123, return 321` `Example2: x = -123, return -321` The input is assumed to be a 32-bit signed integer. Your function should return 0 when the reversed integer overflows.

# LeetCode 6. ZigZag Conversion

ZigZag Conversion

## Description

The string `"PAYPALISHIRING"` is written in a zigzag pattern on a given number of rows like this: (you may want to display this > pattern in a fixed font for better legibility)

``````P   A   H   N
A P L S I I G
Y   I   R
``````

And then read line by line: `"PAHNAPLSIIGYIR"`

Write the code that will take a string and make this conversion given a number of rows:

``string convert(string text, int nRows);``

`convert("PAYPALISHIRING", 3)` should return `"PAHNAPLSIIGYIR"`.

# LeetCode 5. Longest Palindromic Substring

Longest Palindromic Substring

## Description

Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.

Example:

``````Input: "babad"
Output: "bab"
``````

Note: “aba” is also a valid answer.

Example:

``````Input: "cbbd"
Output: "bb"
``````

# LeetCode 4. Median of Two Sorted Arrays

Median of Two Sorted Arrays

## Description

There are two sorted arrays nums1 and nums2 of size m and n respectively.

Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).

Example 1:

``````nums1 = [1, 3]
nums2 = [2]
``````

The median is 2.0 Example 2:

``````nums1 = [1, 2]
nums2 = [3, 4]
``````

The median is (2 + 3)/2 = 2.5

Programer

ChengDu·China