摘要: 17.14 Oh, no! You have just completed a lengthy document when you have an unfortunate Find/Replace mishap. You have accidentally removed all spaces, p 阅读全文
posted @ 2016-04-30 12:20 Grandyang 阅读(862) 评论(0) 推荐(0)
摘要: A message containing letters from A-Z is being encoded to numbers using the following mapping: 'A' -> 1'B' -> 2...'Z' -> 26Given an encoded message co 阅读全文
posted @ 2016-04-30 12:18 Grandyang 阅读(1189) 评论(0) 推荐(0)
摘要: Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, ...) which sum to n. ExampleGiven n = 12, retur 阅读全文
posted @ 2016-04-30 12:16 Grandyang 阅读(2142) 评论(0) 推荐(0)
摘要: There is a fence with n posts, each post can be painted with one of the k colors.You have to paint all the posts such that no more than two adjacent f 阅读全文
posted @ 2016-04-30 12:14 Grandyang 阅读(807) 评论(0) 推荐(0)
摘要: There are a row of n houses, each house can be painted with one of the three colors: red, blue or green. The cost of painting each house with a certai 阅读全文
posted @ 2016-04-30 12:13 Grandyang 阅读(1062) 评论(0) 推荐(0)
摘要: There are a row of n houses, each house can be painted with one of the k colors. The cost of painting each house with a certain color is different. Yo 阅读全文
posted @ 2016-04-30 12:10 Grandyang 阅读(1030) 评论(0) 推荐(0)
摘要: Write a program to check whether a given number is an ugly number`. Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For ex 阅读全文
posted @ 2016-04-30 12:07 Grandyang 阅读(523) 评论(0) 推荐(0)
摘要: Java和C++中都有关于子字符串的操作,C++中是substr(),Java中是substring(),两者的用法上稍有些区别,首先针对只有一个参数的情况: s.substr(start) 和 s.substring(start) 均表示从start位置开始到结尾的子字符串 而对于有两个参数的情况 阅读全文
posted @ 2016-04-30 00:21 Grandyang 阅读(3226) 评论(1) 推荐(2)
Fork me on GitHub