原题链接在这里:https://leetcode.com/problems/number-of-dice-rolls-with-target-sum/ 题目: You have d dice, and each die has f faces numbered 1, 2, ..., f. Retur ...
分类:
其他好文 时间:
2020-01-15 13:57:57
阅读次数:
74
原题链接在这里:https://leetcode.com/problems/design-hashmap/ 题目: Design a HashMap without using any built-in hash table libraries. To be specific, your desig ...
分类:
其他好文 时间:
2020-01-15 13:32:54
阅读次数:
74
原题链接在这里:https://leetcode.com/problems/coin-change-2/ 题目: You are given coins of different denominations and a total amount of money. Write a function ...
分类:
其他好文 时间:
2020-01-15 09:55:48
阅读次数:
59
"题面" 题解 学长讲课题目的质量果然和我平常找的那些不一样 思路还是可以说比较巧妙的 考虑到我们并不好算出对于所有大小为 $i$ 的点集,能够包含它的最小连通块大小 转换题目 这个时候我们应该想到把目标放到单个点 $i$ 对选择 $k$ 个点时的贡献 那么他的贡献就是总方案数减去没选的方案数对吧 ...
分类:
其他好文 时间:
2020-01-15 09:51:50
阅读次数:
63
https://pintia.cn/problem-sets/12/problems/342 1 bool palindrome(char *s) 2 { 3 int n, i, k; 4 bool ret; 5 6 n = strlen(s); 7 i = 0; 8 k = n - 1; 9 wh ...
分类:
其他好文 时间:
2020-01-14 20:59:58
阅读次数:
89
两数之和 II 输入有序数组 LeetCode: "两数之和 II 输入有序数组" 题目描述: 给定一个已按照升序排列?的有序数组,找到两个数使得它们相加之和等于目标数。 函数应该返回这两个下标值 index1 和 index2,其中 index1?必须小于?index2。 示例: 思想: 使用双指 ...
分类:
编程语言 时间:
2020-01-14 16:00:07
阅读次数:
69
原题链接在这里:https://leetcode.com/problems/search-suggestions-system/ 题目: Given an array of strings products and a string searchWord. We want to design a s ...
分类:
其他好文 时间:
2020-01-14 09:19:51
阅读次数:
73
1009 说反话 (20分) 题目地址:https://pintia.cn/problem sets/994805260223102976/problems/994805314941992960 给定一句英语,要求你编写程序,将句中所有单词的顺序颠倒输出。 输入格式: 测试输入包含一个测试用例,在一 ...
分类:
其他好文 时间:
2020-01-13 22:04:56
阅读次数:
62
题目描述:括号(小括号、中括号、大括号)的匹配 传送门:https://leetcode-cn.com/problems/valid-parentheses/ 解法:《数据结构》中作为例子引出栈的概念。用一个栈维护,从左到右扫描目标字符串,如果括号匹配,即满足三种情况: ①、s[i] == ')' ...
分类:
其他好文 时间:
2020-01-13 20:19:49
阅读次数:
95
414 第三大的数 给定一个非空数组,返回此数组中第三大的数。如果不存在,则返回数组中最大的数。要求算法时间复杂度必须是O(n)。 示例 1: 示例 2: 示例 3: 来源:力扣(LeetCode) 链接:https://leetcode cn.com/problems/third maximum ...
分类:
其他好文 时间:
2020-01-13 20:00:46
阅读次数:
93