Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
输入:s = "ADOBECODEBANC", t = "ABC" 输出:"BANC" 解释:最小覆盖子串 "BANC" 包含来自字符串 t 的 'A'、'B' 和 'C'。 示例2: 输入:s = "a", t = "a" 输出:"a" 解释:整个字符串 s 是最小覆盖子串。 示例3: 输入: s = "a", t = "aa" 输出: "" 解释: t 中两个字符 '...
【题目】Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T. The same repeated number may be chosen from C unlimited number of times. Note: All numbers (including target) will be positive ...
对C语言相当不友好,使用hash去重,遍历杨辉三角检查两个相同账号是否有相同的邮箱,有通过并查集加入集合。最后返回数组大小就是并查集count。遍历所有账号,检查是根节点,把元素存储返回数组。再遍历其他数组,检查和他是同一个集合的,做去重处理,最后再做qsort排序。对于C语言这个实在太考验基本功了 不...
【leetcode刷题】T42-快乐数 【英文题目】(学习英语的同时,更能理解题意哟~) Write an algorithm to determine if a number is "happy". A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares of its digits...
Please don't post any solutions in this discussion. 2. The problem discussion is for asking questions about the problem or for sharing tips - anything except for solutions. 3. If you'd like to share your solution for feedback and ideas, please head to the solutions tab and post it ...
Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as: a binary tree in which the depth of the two subtrees of every node never differ by more than 1. Example 1: Given the following tree [3,9,20,null,null,15,7]: 3...
strs[i] = String.valueOf(nums[i]); quickSort(strs, 0, strs.length - 1); StringBuilder res = new StringBuilder(); for(String s : strs) res.append(s); return res.toString(); } void quickSort(String[] strs, int l, int r) { if(l >= r) return; int i = l, j = r;...
https://leetcode.com/problems/remove-nth-node-from-end-of-list/https://leetcode.com/problems/r...
Problem 4: Leetcode 115 给定一个字符串 s 和一个字符串 t ,计算在 s 的子序列中 t 出现的个数。 字符串的一个 子序列 是指,通过删除一些(也可以不删除)字符且不干扰剩余字符相对位置所组成的新字符串。(例如,"ACE" 是 "ABCDE" 的一个子序列,而 "AEC" 不是) ...