package com.example.leetcode; import java.util.*; /** * @description: 40. 组合总和 II * 给定一个数组 candidates 和一个目标数 target ,找出 candidates 中所有可以使数字和为 target 的 ...
分类:
其他好文 时间:
2021-04-28 12:01:50
阅读次数:
0
给你一个二叉树,请你返回其按 层序遍历 得到的节点值。 (即逐层地,从左到右访问所有节点)。 示例:二叉树:[3,9,20,null,null,15,7], 3 / \ 9 20 / \ 15 7返回其层序遍历结果: [ [3], [9,20], [15,7]] 来源:力扣(LeetCode)链接: ...
分类:
其他好文 时间:
2021-04-28 11:43:36
阅读次数:
0
给定二叉搜索树的根结点 root,返回值位于范围 [low, high] 之间的所有结点的值的和。 示例 1: 输入:root = [10,5,15,3,7,null,18], low = 7, high = 15输出:32示例 2: 输入:root = [10,5,15,3,7,13,18,1,n ...
分类:
其他好文 时间:
2021-04-27 15:25:18
阅读次数:
0
此博客链接: 题解: 找大写26个字母的位置,26个字母可以重复M个 输入为N M,N测试用例个数,M为字母重复个数, 输出字母和处于第几位 代码 public class leetcode { public static void main(String[] args) { Scanner sca ...
分类:
其他好文 时间:
2021-04-27 14:19:47
阅读次数:
0
给定两个整数,被除数 dividend 和除数 divisor。将两数相除,要求不使用乘法、除法和 mod 运算符。 返回被除数 dividend 除以除数 divisor 得到的商。 整数除法的结果应当截去(truncate)其小数部分,例如:truncate(8.345) = 8 以及 trun ...
分类:
其他好文 时间:
2021-04-26 13:41:31
阅读次数:
0
二叉树——113. 路径总和 II 题目: 思路: 前序遍历+回溯 代码参考:https://leetcode-cn.com/problems/path-sum-ii/solution/cqian-xu-bian-li-jia-hui-su-by-qing-feng-seve/ 代码: class ...
分类:
其他好文 时间:
2021-04-26 13:26:18
阅读次数:
0
Description: Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it can trap after ra ...
分类:
移动开发 时间:
2021-04-26 13:21:39
阅读次数:
0
质数的算法: 1,判断n是否能被2~n-1整除 输入的数n不能被2-(n-1)整除,说明是素数 输入的数n能被2-(n-1)整除,说明不是素数 #include<stdio.h> int main() { int i, n; bool i; printf("please input a number ...
分类:
其他好文 时间:
2021-04-26 13:14:06
阅读次数:
0
题目描述 给你一个由 无重复 正整数组成的集合 nums ,请你找出并返回其中最大的整除子集 answer ,子集中每一元素对 (answer[i], answer[j]) 都应当满足: answer[i] % answer[j] == 0 ,或 answer[j] % answer[i] == 0 ...
分类:
其他好文 时间:
2021-04-24 13:44:37
阅读次数:
0
此博客链接: 连续字符 题目链接:https://leetcode-cn.com/problems/consecutive-characters/ 题目 给你一个字符串 s ,字符串的「能量」定义为:只包含一种字符的最长非空子字符串的长度。 请你返回字符串的能量。 示例 1: 输入:s = "lee ...
分类:
其他好文 时间:
2021-04-24 13:43:55
阅读次数:
0