码迷,mamicode.com
首页 >  
搜索关键字:given n integers    ( 24278个结果
【leetcode】1315. Sum of Nodes with Even-Valued Grandparent
题目如下: Given a binary tree, return the sum of values of nodes with even-valued grandparent. (A grandparent of a node is the parent of its parent, if it ...
分类:其他好文   时间:2020-01-12 17:53:44    阅读次数:56
Lc18-四数之和
import java.util.ArrayList; import java.util.List; /** * Given an array nums of n integers and an integer target, are there elements * a, b, c, and d ...
分类:其他好文   时间:2020-01-12 15:29:51    阅读次数:121
Lc17-电话号码的字母组合
import java.util.ArrayList; import java.util.LinkedList; import java.util.List; /* * Given a string containing digits from 2-9 inclusive, return all p ...
分类:其他好文   时间:2020-01-12 15:05:05    阅读次数:91
[LeetCode] 112. Path Sum
二叉树的路径和。题意是给一个二叉树和一个数字sum。求是否有这样一条路径可以使得二叉树从根节点到叶子节点经过的所有的节点值之和等于sum。此题可以用BFS和DFS两种做法解决,时间和空间复杂度都是O(n)。例子如下, Example: Given the below binary tree and  ...
分类:其他好文   时间:2020-01-12 15:04:09    阅读次数:65
[LeetCode] 113. Path Sum II
二叉树的路径和二。题意跟版本一很接近,唯一的不同是版本一只是问是否有满足条件的路径;版本二是输出所有满足条件的路径和。例子, Example: Given the below binary tree and sum = 22, 5 / \ 4 8 / / \ 11 13 4 / \ / \ 7 2 ...
分类:其他好文   时间:2020-01-12 14:56:50    阅读次数:47
[LC] 1099. Two Sum Less Than K
Given an array A of integers and integer K, return the maximum S such that there exists i < j with A[i] + A[j] = S and S < K. If no i, j exist satisfy ...
分类:其他好文   时间:2020-01-12 11:53:41    阅读次数:79
[LC] 398. Random Pick Index
Given an array of integers with possible duplicates, randomly output the index of a given target number. You can assume that the given target number m ...
分类:其他好文   时间:2020-01-12 09:53:56    阅读次数:64
LeetCode 451. Sort Characters By Frequency 根据字符出现频率排序 (C++/Java)
题目: Given a string, sort it in decreasing order based on the frequency of characters. Example 1: Input: "tree" Output: "eert" Explanation: 'e' appears ...
分类:编程语言   时间:2020-01-12 09:51:15    阅读次数:93
[LeetCode] 102. Binary Tree Level Order Traversal
二叉树层序遍历。题干既是题意。如下例子, For example:Given binary tree [3,9,20,null,null,15,7], 3 / \ 9 20 / \ 15 7 return its level order traversal as: [ [3], [9,20], [1 ...
分类:其他好文   时间:2020-01-12 09:41:11    阅读次数:54
LeetCode #275 H-Index II
Question Given an array of citations sorted in ascending order (each citation is a non-negative integer) of a researcher, write a function to compute ...
分类:其他好文   时间:2020-01-10 00:53:46    阅读次数:74
24278条   上一页 1 ... 91 92 93 94 95 ... 2428 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!