Given a constant K and a singly linked list L, you are supposed to reverse the links of every K elements on L. For example, given L being 1→2→3→4→5→6, ...
分类:
其他好文 时间:
2020-03-13 13:03:41
阅读次数:
52
删除二叉搜索树中的节点。题意是给一个二叉搜索树和一个节点key,请将key从BST中删除并维持BST的性质。例子, Example: root = [5,3,6,2,4,null,7] key = 3 5 / \ 3 6 / \ \ 2 4 7 Given key to delete is 3. S ...
分类:
其他好文 时间:
2020-03-12 10:15:46
阅读次数:
59
Given a binary tree root, a ZigZag path for a binary tree is defined as follow: Choose any node in the binary tree and a direction (right or left). If ...
分类:
其他好文 时间:
2020-03-12 09:26:04
阅读次数:
76
1105 Spiral Matrix (25分) This time your job is to fill a sequence of N positive integers into a spiral matrix in non increasing order. A spiral matrix ...
分类:
其他好文 时间:
2020-03-11 23:40:07
阅读次数:
75
02-线性结构3 Reversing Linked List (25分) Given a constant K and a singly linked list L, you are supposed to reverse the links of every K elements on L. Fo ...
分类:
其他好文 时间:
2020-03-11 23:38:11
阅读次数:
110
先上题目: C. Two operations time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You are given an ...
分类:
其他好文 时间:
2020-03-11 19:28:17
阅读次数:
66
Find the sum of all left leaves in a given binary tree. Example: 3 / \ 9 20 / \ 15 7 There are two left leaves in the binary tree, with values 9 and 1 ...
分类:
其他好文 时间:
2020-03-10 19:55:11
阅读次数:
54
题目链接:https://codeforces.com/contest/1311/problem/D 题意: 给出三个整数 a ≤ b ≤ c ,您可以添加+1 或 1 到这三个整数中的任何一个增加或减少 1 ,可以执行任意次(可能为零)次这样的操作,甚至可以一次执行多次。求执行此类操作的最少次数, ...
分类:
其他好文 时间:
2020-03-09 16:21:38
阅读次数:
43
You are given two integers nn and dd . You need to construct a rooted binary tree consisting of nn vertices with a root at the vertex 11 and the sum o ...
分类:
其他好文 时间:
2020-03-09 10:32:58
阅读次数:
52
Right now she actually isn't. But she will be, if you don't solve this problem. You are given integers n, k, A and B. There is a number x, which is in ...
分类:
其他好文 时间:
2020-03-08 16:02:10
阅读次数:
75