给定一个整数数组 nums 和一个目标值 target,请你在该数组中找出和为目标值的那 两个 整数,并返回他们的数组下标。 你可以假设每种输入只会对应一个答案。但是,数组中同一个元素不能使用两遍。 class Solution(object): def twoSum(self, nums, tar ...
分类:
其他好文 时间:
2020-05-29 16:22:37
阅读次数:
69
题目要求 算法分析 按照数组顺序偷,将每个房子累计可能偷到的最大值记录下来, 到第0个房子累计偷到的最大值Value[0] = nums[0] 到第1个房子累计偷到的最大值Value[1] = Max( Value[0],nums[1]) 到第2个房子累计偷到的最大值Value[2] = Max( ...
分类:
其他好文 时间:
2020-05-29 13:40:38
阅读次数:
46
分辨率 public void ResolutionRatio(int value) { // Debug.Log(value); PlayerPrefs.SetInt("ResolutionRatio", value); switch (value) { case 0: if (PlayerPre ...
分类:
编程语言 时间:
2020-05-29 12:00:14
阅读次数:
218
解法一:哈希表 class Solution { public: bool isHappy(int n) { set<int> seen; while (n != 1 && !seen.count(n)) //快乐或者存在环跳出 { seen.insert(n); n = getNext(n); } ...
分类:
移动开发 时间:
2020-05-29 10:23:19
阅读次数:
61
1. LeetCode Link LeetCode 1051. 高度检查器 2. Tag 数组 Optimize 3. Code 桶排序,时间复杂度$O(n)$ class Solution { public: int heightChecker(vector<int>& heights) { in ...
分类:
其他好文 时间:
2020-05-29 09:53:51
阅读次数:
66
#L1-046 整除光棍 题目链接:[https://pintia.cn/problem-sets/994805046380707840/problems/994805084284633088) ###涉及知识点: 思维、数学 ###solution: $这道题如果你做的话你会发现数据很大,如果直接 ...
分类:
其他好文 时间:
2020-05-29 09:35:20
阅读次数:
53
原因:pip版本过低导致安装第三方库失败。 解决办法:更新pip版本 方案一:执行命令easy_install -U pip 方案二:若方案一失败,则可采用使用国内源下载更新。执行命令:python -m pip install --upgrade pip -i https://pypi.douba ...
分类:
编程语言 时间:
2020-05-28 23:47:43
阅读次数:
1267
1 class Solution { 2 public int ptr = 0; 3 public String decodeString(String s) { 4 LinkedList<String> stk = new LinkedList<>(); 5 while(ptr < s.lengt ...
分类:
其他好文 时间:
2020-05-28 21:25:08
阅读次数:
53
题目: 两个数组的交集 II:给定两个数组,编写一个函数来计算它们的交集。 示例 1: 输入: nums1 = [1,2,2,1], nums2 = [2,2]输出: [2,2]示例 2: 输入: nums1 = [4,9,5], nums2 = [9,4,9,8,4]输出: [4,9]说明: 输出 ...
分类:
编程语言 时间:
2020-05-28 19:46:48
阅读次数:
186
题目 比较两个字符串,有多少相同位置的字符是相同的,相同的字符放在不同的位置 class Solution { public: int digit[10]; string getHint(string secret, string guess) { int a = 0, b = 0; for (in ...
分类:
其他好文 时间:
2020-05-28 13:20:49
阅读次数:
49