摘要:
Given a non-empty binary search tree and a target value, find the value in the BST that is closest to the target. Note: Given target value is a floati 阅读全文
摘要:
Given n nodes labeled from 0 to n - 1 and a list of undirected edges (each edge is a pair of nodes), write a function to check whether these edges mak 阅读全文
摘要:
Given an array of scores that are non-negative integers. Player 1 picks one of the numbers from either end of the array followed by the player 2 and t 阅读全文
摘要:
We are playing the Guess Game. The game is as follows: I pick a number from 1 to n. You have to guess which number I picked. Every time you guess wron 阅读全文
摘要:
We are playing the Guess Game. The game is as follows: I pick a number from 1 to n. You have to guess which number I picked. Every time you guess wron 阅读全文
摘要:
转自: only_on_one 前天参加58集团笔试,最后的问答题有一道这样的题,事后推敲后觉得很有意思,就记录下来吧。 给定100个乒乓球,甲乙两人轮流拿,每人每次最少拿1个,最多拿6个,问有没有必胜的拿法,如有,哪方必胜? 答:有必胜的方法,先拿的必胜。通过列举法找到规律: 从上述规律可以看出, 阅读全文
摘要:
我写的Python代码: class Solution(object): def getNumberGame(self, n, nums): m = len(nums) dp = [[0] * m for j in xrange(m)] for i in xrange(m): dp[i][i] = 阅读全文