题目: 解析: 首先如何判断三个边长能否组成一个三角形,这个初中数学就学过——两个小边的和大于最大边的边长。 因此,很容易得到解法,对nums数组排序后,做全排列,依次检查每种组合是否符合要求。 但是非常遗憾,这种解法的复杂度是 O(n*3),超时了。根据判定中给出的超时输入发现,nums里面很多边 ...
分类:
其他好文 时间:
2017-06-13 12:38:39
阅读次数:
221
问题: 在Sudoku Solver 中说道,会有一些提示解。这里就是验证下给定的提示解是否合法,即已经填加的数是否满足要求的三个条件。 bool isValidSudoku(vector<vector<char> > &board) { const int M = 9;//9 * 9 const ...
分类:
其他好文 时间:
2017-06-12 14:51:51
阅读次数:
212
题目一:Valid Number Validate if a given string is numeric. Some examples: "0" => true " 0.1 " => true "abc" => false "1 a" => false "2e10" => true Note: ...
分类:
其他好文 时间:
2017-06-12 11:52:00
阅读次数:
167
Given a binary search tree, write a function kthSmallest to find the kth smallest element in it. Note: You may assume k is always valid, 1 ? k ? BST's ...
分类:
其他好文 时间:
2017-06-12 00:42:23
阅读次数:
175
1、问题描写叙述 Xcode6真机測试旧project,不能执行,报错例如以下: 2、解决方式 问题非常明显,当前的执行模式设置了ONLY_ACTIVE_ARCH为Yes,当时的project的Valid Architectures仅仅包括了armv7和armv7s,解决方式:将ONLY_ACTIV ...
分类:
其他好文 时间:
2017-06-11 13:46:18
阅读次数:
184
Given an array consists of non-negative integers, your task is to count the number of triplets chosen from the array that can make triangles if we tak ...
分类:
其他好文 时间:
2017-06-11 13:45:57
阅读次数:
275
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. The brackets must close in the ...
分类:
其他好文 时间:
2017-06-11 12:08:21
阅读次数:
137
Managed-by-Xcode provisioning profile that expired. You are using a “Team Provisioning Profile” and it expired. You went to renew and download it, and ...
分类:
其他好文 时间:
2017-06-10 20:26:01
阅读次数:
155
https://leetcode.com/problems/valid-anagram/#/description Given two strings s and t, write a function to determine if t is an anagram of s. For exampl ...
分类:
其他好文 时间:
2017-06-10 18:28:01
阅读次数:
254