上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 29 下一页
摘要: Design a data structure that supports all following operations in average O(1) time. Example: 性能这么好肯定是得空间换时间。加删都是O(1),想到要用到Hash,但是HashSet不能random存取,所以 阅读全文
posted @ 2017-12-01 09:57 jasminemzy 阅读(156) 评论(0) 推荐(0) 编辑
摘要: Given an array of words and a length L, format the text such that each line has exactly L characters and is fully (left and right) justified. You shou 阅读全文
posted @ 2017-12-01 07:06 jasminemzy 阅读(169) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers nums and a positive integer k, find whether it's possible to divide this array into k non-empty subsets whose sums are all 阅读全文
posted @ 2017-12-01 04:37 jasminemzy 阅读(596) 评论(0) 推荐(0) 编辑
摘要: Given a non-empty special binary tree consisting of nodes with the non-negative value, where each node in this tree has exactly twoor zero sub-node. I 阅读全文
posted @ 2017-11-30 13:33 jasminemzy 阅读(151) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2017-11-30 08:59 jasminemzy 阅读(132) 评论(0) 推荐(0) 编辑
摘要: Given a non-negative integer c, your task is to decide whether there're two integers a and b such that a2 + b2 = c. Example 1: Example 2: 算法: 1. 递增法。用 阅读全文
posted @ 2017-11-29 15:29 jasminemzy 阅读(134) 评论(0) 推荐(0) 编辑
摘要: Suppose you have a long flowerbed in which some of the plots are planted and some are not. However, flowers cannot be planted in adjacent plots - they 阅读全文
posted @ 2017-11-29 15:04 jasminemzy 阅读(106) 评论(0) 推荐(0) 编辑
摘要: You need to find the largest value in each row of a binary tree. Example: 算法: 1.BFS。层级遍历,每层打擂台。 2.DFS。记录从上到下的深度,每层参数里传下去+1即可。(从下到上的深度是通过回传int返回值来递归实现的 阅读全文
posted @ 2017-11-29 14:21 jasminemzy 阅读(123) 评论(0) 推荐(0) 编辑
摘要: In the "100 game," two players take turns adding, to a running total, any integer from 1..10. The player who first causes the running total to reach o 阅读全文
posted @ 2017-11-29 11:57 jasminemzy 阅读(237) 评论(0) 推荐(0) 编辑
摘要: You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 ston 阅读全文
posted @ 2017-11-29 09:13 jasminemzy 阅读(142) 评论(0) 推荐(0) 编辑
上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 29 下一页