摘要:
Given a 2D board and a word, find if the word exists in the grid. The word can be constructed from letters of sequentially adjacent cell, where "adjac 阅读全文
摘要:
You are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you nee 阅读全文
摘要:
传送门 Problem Description 给定K个整数的序列{ N1, N2, ..., NK },其任意连续子序列可表示为{ Ni, Ni+1, ..., Nj },其中 1 <= i <= j <= K。最大连续子序列是所有连续子序列中元素和最大的一个, 例如给定序列{ -2, 11, - 阅读全文
摘要:
传送门问题描述某天,acm的小秋拿到了一张很大很大的纸。他现在打算把它撕成正方 形。但是他没有任何工具,没有尺子,所以他尝试一种有趣的方法切分矩形。假设这是一个a*b的矩形(a>b),那么小秋会先把矩形的一个角如图所示 折起,这样右边就会形成一个正方形,然后把正方形切割出来,如果还存在长方形,小秋会... 阅读全文
摘要:
Problem Description一 个正整数,如果从左向右读(称之为正序数)和从右向左读(称之为倒序数)是一样的,这样的数就叫回文数。任取一个正整数,如果不是回文数,将该数与他的倒 序数相加,若其和不是回文数,则重复上述步骤,一直到获得回文数为止。例如:68变成154(68+86),再变成60... 阅读全文
摘要:
190. Reverse BitsReverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as 000000101001010000011110... 阅读全文
摘要:
题目:Given an input string, reverse the string word by word. For example,Given s = "the sky is blue",return "blue is sky the".Clarification:What constit... 阅读全文
摘要:
题目:Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:... 阅读全文
摘要:
Given a string which contains only lowercase letters, remove duplicate letters so that every letter appear once and only once. You must make sure your... 阅读全文
摘要:
题目的意思就是在1到n的所有序列之间,找出所有相邻的数相加是素数的序列。Ps:题目是环,所以头和尾也要算哦~典型的dfs,然后剪枝。这题目有意思的就是用java跑回在tle的边缘,第一次提交就tle了(服务器负载的问题吧),一模一样的第二次提交就ac了,侧面也反应了递归对stack的开销影响效率也是... 阅读全文