it ('should add two numbers', () => { const logger = jasmine.createSpyObj('LoggerService', ['log']) // logger.log.and.returnValue(); const calculator ...
分类:
其他好文 时间:
2020-02-10 09:52:34
阅读次数:
50
题意:对于一个有序数组,输出和为target的两个元素的下标。题目保证仅有唯一解。 分析: 法一:二分。枚举第一个元素,二分找另一个元素,时间复杂度O(nlogn),非最优解。 class Solution { public: vector<int> twoSum(vector<int>& numb ...
分类:
其他好文 时间:
2020-02-09 22:14:01
阅读次数:
73
"题目" 用hash,比较两个字符串数组的每个字符的hash值 ...
分类:
其他好文 时间:
2020-02-09 20:36:37
阅读次数:
64
题目如下: Given an array arr of integers, check if there exists two integers N and M such that N is the double of M ( i.e. N = 2 * M). More formally check ...
分类:
其他好文 时间:
2020-02-09 18:55:33
阅读次数:
79
题目如下: Given two equal-size strings s and t. In one step you can choose any character of t and replace it with another character. Return the minimum nu ...
分类:
其他好文 时间:
2020-02-09 18:39:10
阅读次数:
68
题目如下: Given an array of integers arr and two integers k and threshold. Return the number of sub-arrays of size k and average greater than or equal to ...
分类:
其他好文 时间:
2020-02-09 18:18:53
阅读次数:
52
题目如下: Given two numbers, hour and minutes. Return the smaller angle (in sexagesimal units) formed between the hour and the minute hand. Example 1: Inp ...
分类:
其他好文 时间:
2020-02-09 18:15:29
阅读次数:
313
题目如下: Implement the class TweetCounts that supports two methods: 1. recordTweet(string tweetName, int time) Stores the tweetName at the recorded time ...
分类:
其他好文 时间:
2020-02-09 18:10:45
阅读次数:
50
Link class Solution { public: int ladderLength(string beginWord, string endWord, vector<string>& wordList) { unordered_set<string> words; for(auto &s: ...
分类:
其他好文 时间:
2020-02-09 11:19:33
阅读次数:
67
Flip game is played on a rectangular 4x4 field with two-sided pieces placed on each of its 16 squares. One side of each piece is white and the other o ...
分类:
其他好文 时间:
2020-02-08 22:02:58
阅读次数:
86