摘要:
思路:动态规划。对于第i行第j列的元素grid[i][j]表示的是这个元素的plus sign的等级,初始化不在mines中的元素对应的grid值为较大值(只要大于N/2即可),在mines中的元素对应的grid值为0。不在mines中的元素,其grid[i][j]=左右上下四个方向最少的连续1的个 阅读全文
摘要:
思路:动态规划。注意1024*1024>10^6,所以质素范围是(0,23)。 阅读全文
摘要:
Next challenges: Android Unlock Patterns Maximum XOR of Two Numbers in an Array Maximum Vacation Days 思路:动态规划。 两种分解方法: count[i]表示的是i的二进制表示中1的个数。 1.cou 阅读全文
摘要:
A message containing letters from A-Z is being encoded to numbers using the following mapping: Given an encoded message containing digits, determine t 阅读全文
摘要:
Given a string s, find the longest palindromic subsequence's length in s. You may assume that the maximum length of s is 1000. Example 1:Input: Output 阅读全文
摘要:
Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: Example: Similar Question 阅读全文
摘要:
Given a string, your task is to count how many palindromic substrings in this string. The substrings with different start indexes or end indexes are c 阅读全文
摘要:
Compare two version numbers version1 and version2.If version1 > version2 return 1, if version1 < version2 return -1, otherwise return 0. You may assum 阅读全文
摘要:
Given a word, you need to judge whether the usage of capitals in it is right or not. We define the usage of capitals in a word to be right when one of 阅读全文
摘要:
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. For example,"A man, a plan, a canal: Pan 阅读全文