12 2018 档案

摘要:https://pintia.cn/problem-sets/994805342720868352/problems/994805409175420928 Given two sets of integers, the similarity of the sets is defined to be  阅读全文
posted @ 2018-12-29 15:08 _Zlrrr 阅读(321) 评论(0) 推荐(0)
摘要:https://pintia.cn/problem-sets/994805342720868352/problems/994805485033603072 Suppose that all the keys in a binary tree are distinct positive integer 阅读全文
posted @ 2018-12-29 11:33 _Zlrrr 阅读(273) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/construct-string-from-binary-tree/ You need to construct a string consists of parenthesis and integers from a binary tre 阅读全文
posted @ 2018-12-29 10:22 _Zlrrr 阅读(161) 评论(0) 推荐(0)
摘要:https://pintia.cn/problem-sets/994805342720868352/problems/994805349394006016 Suppose that all the keys in a binary tree are distinct positive integer 阅读全文
posted @ 2018-12-28 21:28 _Zlrrr 阅读(328) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/construct-binary-tree-from-inorder-and-postorder-traversal/ Given inorder and postorder traversal of a tree, construct t 阅读全文
posted @ 2018-12-28 15:14 _Zlrrr 阅读(134) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/trim-a-binary-search-tree/ Given a binary search tree and the lowest and highest boundaries as L and R, trim the tree so 阅读全文
posted @ 2018-12-27 22:29 _Zlrrr 阅读(127) 评论(0) 推荐(0)
摘要:https://pintia.cn/problem-sets/994805342720868352/problems/994805415005503488 Given any positive integer N, you are supposed to find all of its prime 阅读全文
posted @ 2018-12-27 16:51 _Zlrrr 阅读(232) 评论(0) 推荐(0)
摘要:http://codeforces.com/contest/1092/problem/D2 Vova's family is building the Great Vova Wall (named by Vova himself). Vova's parents, grandparents, gra 阅读全文
posted @ 2018-12-27 15:03 _Zlrrr 阅读(258) 评论(0) 推荐(0)
摘要:http://codeforces.com/contest/1092/problem/D1 Vova's family is building the Great Vova Wall (named by Vova himself). Vova's parents, grandparents, gra 阅读全文
posted @ 2018-12-27 14:43 _Zlrrr 阅读(251) 评论(0) 推荐(0)
摘要:http://codeforces.com/contest/1092/problem/C Ivan wants to play a game with you. He picked some string ss of length nn consisting only of lowercase La 阅读全文
posted @ 2018-12-27 13:49 _Zlrrr 阅读(255) 评论(0) 推荐(0)
摘要:http://codeforces.com/contest/1092/problem/B There are nn students in a university. The number of students is even. The ii-th student has programming 阅读全文
posted @ 2018-12-27 11:23 _Zlrrr 阅读(212) 评论(0) 推荐(0)
摘要:http://codeforces.com/contest/1092/problem/A You are given two integers nn and kk. Your task is to construct such a string ss of length nn that for ea 阅读全文
posted @ 2018-12-27 11:11 _Zlrrr 阅读(285) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/populating-next-right-pointers-in-each-node/ Given a binary tree Populate each next pointer to point to its next right n 阅读全文
posted @ 2018-12-24 11:12 _Zlrrr 阅读(150) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree/ Given a binary tree, find the lowest common ancestor (LCA) of two given nodes i 阅读全文
posted @ 2018-12-23 21:45 _Zlrrr 阅读(119) 评论(0) 推荐(0)
摘要:https://pintia.cn/problem-sets/994805342720868352/problems/994805446102073344 Given a string, you are supposed to output the length of the longest sym 阅读全文
posted @ 2018-12-23 11:18 _Zlrrr 阅读(341) 评论(0) 推荐(0)
摘要:http://poj.org/problem?id=1276 Description A Bank plans to install a machine for cash withdrawal. The machine is able to deliver appropriate @ bills f 阅读全文
posted @ 2018-12-22 21:49 _Zlrrr 阅读(208) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/intersection-of-two-arrays/ Given two arrays, write a function to compute their intersection. Example 1: Example 2: Inpu 阅读全文
posted @ 2018-12-22 16:48 _Zlrrr 阅读(105) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/sort-array-by-parity-ii/ Given an array A of non-negative integers, half of the integers in A are odd, and half of the i 阅读全文
posted @ 2018-12-22 16:35 _Zlrrr 阅读(239) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/intersection-of-two-arrays-ii/ Given two arrays, write a function to compute their intersection. Example 1: Example 2: I 阅读全文
posted @ 2018-12-22 15:50 _Zlrrr 阅读(107) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/hand-of-straights/ Alice has a hand of cards, given as an array of integers. Now she wants to rearrange the cards into g 阅读全文
posted @ 2018-12-22 13:21 _Zlrrr 阅读(175) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/ Given preorder and inorder traversal of a tree, construct the 阅读全文
posted @ 2018-12-22 11:47 _Zlrrr 阅读(116) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/flatten-binary-tree-to-linked-list/ Given a binary tree, flatten it to a linked list in-place. For example, given the fo 阅读全文
posted @ 2018-12-22 10:39 _Zlrrr 阅读(98) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2955 Problem Description The aspiring Roy the Robber has seen a lot of American movies, and knows that the b 阅读全文
posted @ 2018-12-21 18:52 _Zlrrr 阅读(148) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2639 Problem Description The title of this problem is familiar,isn't it?yeah,if you had took part in the "Ro 阅读全文
posted @ 2018-12-21 16:39 _Zlrrr 阅读(157) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1114 Problem Description Before ACM can do anything, a budget must be prepared and the necessary financial s 阅读全文
posted @ 2018-12-21 15:41 _Zlrrr 阅读(141) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1059 Problem Description Marsha and Bill own a collection of marbles. They want to split the collection amon 阅读全文
posted @ 2018-12-21 14:18 _Zlrrr 阅读(160) 评论(0) 推荐(0)
摘要:http://poj.org/problem?id=3624 Description Bessie has gone to the mall's jewelry store and spies a charm bracelet. Of course, she'd like to fill it wi 阅读全文
posted @ 2018-12-20 14:51 _Zlrrr 阅读(128) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2191 Problem Description 急!灾区的食物依然短缺!为了挽救灾区同胞的生命,心系灾区同胞的你准备自己采购一些粮食支援灾区,现在假设你一共有资金n元,而市场有m种大米,每种大米都是袋装产品,其价格 阅读全文
posted @ 2018-12-20 14:23 _Zlrrr 阅读(170) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/flip-equivalent-binary-trees/ For a binary tree T, we can define a flip operation as follows: choose any node, and swap 阅读全文
posted @ 2018-12-19 17:29 _Zlrrr 阅读(188) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/binary-tree-postorder-traversal/ Given a binary tree, return the postorder traversal of its nodes' values. Example: Foll 阅读全文
posted @ 2018-12-19 17:02 _Zlrrr 阅读(113) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal/ Given a binary tree, return the zigzag level order traversal of its nodes' val 阅读全文
posted @ 2018-12-18 21:54 _Zlrrr 阅读(138) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/count-complete-tree-nodes/ Given a complete binary tree, count the number of nodes. Note: Definition of a complete binar 阅读全文
posted @ 2018-12-18 19:09 _Zlrrr 阅读(145) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/binary-tree-level-order-traversal-ii/ Given a binary tree, return the bottom-up level order traversal of its nodes' valu 阅读全文
posted @ 2018-12-18 18:50 _Zlrrr 阅读(140) 评论(0) 推荐(0)
摘要:https://pintia.cn/problem-sets/994805342720868352/problems/994805366343188480 There is a classical process named partition in the famous quick sort al 阅读全文
posted @ 2018-12-18 14:31 _Zlrrr 阅读(362) 评论(0) 推荐(0)
摘要:https://pintia.cn/problem-sets/994805342720868352/problems/994805449625288704 Given a collection of number segments, you are supposed to recover the s 阅读全文
posted @ 2018-12-18 14:11 _Zlrrr 阅读(224) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/path-sum/ Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the value 阅读全文
posted @ 2018-12-18 13:54 _Zlrrr 阅读(109) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/letter-combinations-of-a-phone-number/ Given a string containing digits from 2-9 inclusive, return all possible letter c 阅读全文
posted @ 2018-12-17 22:04 _Zlrrr 阅读(122) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree/ Given a binary search tree (BST), find the lowest common ancestor (LCA) 阅读全文
posted @ 2018-12-17 19:05 _Zlrrr 阅读(127) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/kth-smallest-element-in-a-bst/ Given a binary search tree, write a function kthSmallest to find the kth smallest element 阅读全文
posted @ 2018-12-17 18:18 _Zlrrr 阅读(146) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/binary-tree-level-order-traversal/ Given a binary tree, return the level order traversal of its nodes' values. (ie, from 阅读全文
posted @ 2018-12-17 18:16 _Zlrrr 阅读(115) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/binary-tree-right-side-view/ Given a binary tree, imagine yourself standing on the right side of it, return the values o 阅读全文
posted @ 2018-12-17 18:13 _Zlrrr 阅读(156) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/find-largest-value-in-each-tree-row/ You need to find the largest value in each row of a binary tree. Example: 代码: 今天是不吃 阅读全文
posted @ 2018-12-14 22:45 _Zlrrr 阅读(144) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/binary-tree-preorder-traversal/ Given a binary tree, return the preorder traversal of its nodes' values. Example: Follow 阅读全文
posted @ 2018-12-14 20:49 _Zlrrr 阅读(125) 评论(0) 推荐(0)
摘要:https://pintia.cn/problem-sets/994805342720868352/problems/994805432256675840 Eva loves to collect coins from all over the universe, including some ot 阅读全文
posted @ 2018-12-14 14:12 _Zlrrr 阅读(307) 评论(0) 推荐(0)
摘要:https://pintia.cn/problem-sets/994805342720868352/problems/994805460652113920 To store English words, one method is to use linked lists and store a wo 阅读全文
posted @ 2018-12-14 13:16 _Zlrrr 阅读(419) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/binary-tree-paths/ Given a binary tree, return all root-to-leaf paths. Note: A leaf is a node with no children. Example: 阅读全文
posted @ 2018-12-14 10:15 _Zlrrr 阅读(104) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/minimum-depth-of-binary-tree/ Given a binary tree, find its minimum depth. The minimum depth is the number of nodes alon 阅读全文
posted @ 2018-12-14 09:37 _Zlrrr 阅读(118) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/balanced-binary-tree/ Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binar 阅读全文
posted @ 2018-12-13 22:13 _Zlrrr 阅读(171) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/sum-of-left-leaves/ Find the sum of all left leaves in a given binary tree. Example: 代码: 阅读全文
posted @ 2018-12-13 19:45 _Zlrrr 阅读(120) 评论(0) 推荐(0)
摘要:https://pintia.cn/problem-sets/994805342720868352/problems/994805502658068480 To evaluate the performance of our first year CS majored students, we co 阅读全文
posted @ 2018-12-13 16:07 _Zlrrr 阅读(328) 评论(0) 推荐(0)
摘要:https://vjudge.net/contest/67836#problem/I Given a set of sticks of various lengths, is it possible to join them end-to-end to form a square? Input Th 阅读全文
posted @ 2018-12-13 13:41 _Zlrrr 阅读(221) 评论(0) 推荐(0)
摘要:http://lx.lanqiao.cn/problemset.page?code=BEGIN-&userid=246004 BEGIN-1 A+B问题 代码: #include <bits/stdc++.h> using namespace std; int A, B; int main() { 阅读全文
posted @ 2018-12-12 20:31 _Zlrrr 阅读(237) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/convert-sorted-array-to-binary-search-tree/ Given an array where elements are sorted in ascending order, convert it to a 阅读全文
posted @ 2018-12-12 20:04 _Zlrrr 阅读(148) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/increasing-order-search-tree/ Given a tree, rearrange the tree in in-order so that the leftmost node in the tree is now 阅读全文
posted @ 2018-12-10 22:50 _Zlrrr 阅读(223) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/power-of-three/ Given an integer, write a function to determine if it is a power of three. Example 1: Example 2: Example 阅读全文
posted @ 2018-12-10 22:30 _Zlrrr 阅读(109) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/bulb-switcher/ There are n bulbs that are initially off. You first turn on all the bulbs. Then, you turn off every secon 阅读全文
posted @ 2018-12-10 20:21 _Zlrrr 阅读(134) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/binary-tree-inorder-traversal/ Given a binary tree, return the inorder traversal of its nodes' values. Example: 代码: 二叉树 阅读全文
posted @ 2018-12-10 19:51 _Zlrrr 阅读(122) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/symmetric-tree/ Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For examp 阅读全文
posted @ 2018-12-10 16:13 _Zlrrr 阅读(126) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/search-in-a-binary-search-tree/ Given the root node of a binary search tree (BST) and a value. You need to find the node 阅读全文
posted @ 2018-12-10 15:19 _Zlrrr 阅读(143) 评论(0) 推荐(0)
摘要:在学习二叉树的过程中按照书上打出来的代码 记下来要经常看看 希望我和我的树玩得开心 :-) ①二叉搜索树的插入删除搜索输出 #include <bits/stdc++.h> using namespace std; struct Node { int key; Node *left, *right, 阅读全文
posted @ 2018-12-10 15:01 _Zlrrr 阅读(277) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/maximum-depth-of-binary-tree/ Given a binary tree, find its maximum depth. The maximum depth is the number of nodes alon 阅读全文
posted @ 2018-12-10 14:47 _Zlrrr 阅读(116) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/integer-to-roman/ Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. For example, two is 阅读全文
posted @ 2018-12-10 14:38 _Zlrrr 阅读(149) 评论(0) 推荐(0)
摘要:1091 N-自守数 代码: #include <bits/stdc++.h> using namespace std; int T; int A(int a) { int cnt = 0; while(a) { a /= 10; cnt ++; } return cnt; } int Pow(in 阅读全文
posted @ 2018-12-10 13:20 _Zlrrr 阅读(1585) 评论(3) 推荐(1)
摘要:https://pintia.cn/problem-sets/994805260223102976/problems/994805286714327040 据维基百科的定义: 插入排序是迭代算法,逐一获得输入数据,逐步产生有序的输出序列。每步迭代中,算法从输入序列中取出一元素,将之插入有序序列中正确 阅读全文
posted @ 2018-12-08 17:24 _Zlrrr 阅读(346) 评论(0) 推荐(0)
摘要:https://pintia.cn/problem-sets/994805260223102976/problems/994805270356541440 批改多选题是比较麻烦的事情,本题就请你写个程序帮助老师批改多选题,并且指出哪道题错的人最多。 输入格式: 输入在第一行给出两个正整数 N(≤ 1 阅读全文
posted @ 2018-12-08 16:27 _Zlrrr 阅读(264) 评论(0) 推荐(0)
摘要:https://pintia.cn/problem-sets/994805260223102976/problems/994805273883951104 萌萌哒表情符号通常由“手”、“眼”、“口”三个主要部分组成。简单起见,我们假设一个表情符号是按下列格式输出的: 现给出可选用的符号集合,请你按用 阅读全文
posted @ 2018-12-08 14:43 _Zlrrr 阅读(195) 评论(0) 推荐(0)
摘要:http://codeforces.com/contest/1077/problem/E output standard output output standard output output Polycarp has prepared nn competitive programming pro 阅读全文
posted @ 2018-12-07 22:23 _Zlrrr 阅读(273) 评论(0) 推荐(0)
摘要:https://ac.nowcoder.com/acm/contest/315#question A.平方数 代码: #include <bits/stdc++.h> using namespace std; int n; int ans = 0; int main() { scanf("%d", 阅读全文
posted @ 2018-12-06 23:45 _Zlrrr 阅读(389) 评论(0) 推荐(0)
摘要:http://codeforces.com/contest/1077/problem/D You are given an array ss consisting of nn integers. You have to find any array tt of length kk such that 阅读全文
posted @ 2018-12-06 20:33 _Zlrrr 阅读(185) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/invert-binary-tree/ Invert a binary tree. Example: Input: Output: Trivia:This problem was inspired by this original twee 阅读全文
posted @ 2018-12-05 23:29 _Zlrrr 阅读(104) 评论(0) 推荐(0)
摘要:https://zufeoj.com/contest.php?cid=1483 问题 A: A 代码: #include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 10; int n; int num[maxn]; map 阅读全文
posted @ 2018-12-05 22:53 _Zlrrr 阅读(226) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/same-tree/ Given two binary trees, write a function to check if they are the same or not. Two binary trees are considere 阅读全文
posted @ 2018-12-05 19:51 _Zlrrr 阅读(133) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/zigzag-conversion/ The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you 阅读全文
posted @ 2018-12-05 13:58 _Zlrrr 阅读(143) 评论(0) 推荐(0)
摘要:https://pintia.cn/problem-sets/994805260223102976/problems/994805260583813120 外观数列是指具有以下特点的整数序列: 它从不等于 1 的数字 d 开始,序列的第 n+1 项是对第 n 项的描述。比如第 2 项表示第 1 项有 阅读全文
posted @ 2018-12-04 22:34 _Zlrrr 阅读(268) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/count-and-say/ The count-and-say sequence is the sequence of integers with the first five terms as following: 1 is read 阅读全文
posted @ 2018-12-04 22:32 _Zlrrr 阅读(242) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/generate-parentheses/ Given n pairs of parentheses, write a function to generate all combinations of well-formed parenth 阅读全文
posted @ 2018-12-04 22:26 _Zlrrr 阅读(105) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/first-missing-positive/ Given an unsorted integer array, find the smallest missing positive integer. Example 1: Example 阅读全文
posted @ 2018-12-04 22:05 _Zlrrr 阅读(137) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/combination-sum-ii/ Given a collection of candidate numbers (candidates) and a target number (target), find all unique c 阅读全文
posted @ 2018-12-04 21:52 _Zlrrr 阅读(121) 评论(0) 推荐(0)
摘要:https://pintia.cn/problem-sets/994805260223102976/problems/994805272021680128 拍集体照时队形很重要,这里对给定的 N 个人 K 排的队形设计排队规则如下: 每排人数为 N/K(向下取整),多出来的人全部站在最后一排; 后排 阅读全文
posted @ 2018-12-04 10:21 _Zlrrr 阅读(257) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/combination-sum/ Given a set of candidate numbers (candidates) (without duplicates) and a target number (target), find a 阅读全文
posted @ 2018-12-03 22:11 _Zlrrr 阅读(137) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/middle-of-the-linked-list/ Given a non-empty, singly linked list with head node head, return a middle node of linked lis 阅读全文
posted @ 2018-12-03 15:05 _Zlrrr 阅读(151) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/delete-node-in-a-linked-list/ Write a function to delete a node (except the tail) in a singly linked list, given only ac 阅读全文
posted @ 2018-12-03 14:39 _Zlrrr 阅读(121) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/palindrome-linked-list/ Given a singly linked list, determine if it is a palindrome. Example 1: Example 2: 代码: 妈耶 自己写对的第 阅读全文
posted @ 2018-12-03 14:22 _Zlrrr 阅读(141) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/max-points-on-a-line/ Given n points on a 2D plane, find the maximum number of points that lie on the same straight line 阅读全文
posted @ 2018-12-03 13:05 _Zlrrr 阅读(156) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/maximum-product-subarray/ Given an integer array nums, find the contiguous subarray within an array (containing at least 阅读全文
posted @ 2018-12-02 21:59 _Zlrrr 阅读(123) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/summary-ranges/ Given a sorted integer array without duplicates, return the summary of its ranges. Example 1: Example 2: 阅读全文
posted @ 2018-12-02 18:29 _Zlrrr 阅读(157) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/basic-calculator-ii/ Implement a basic calculator to evaluate a simple expression string. The expression string contains 阅读全文
posted @ 2018-12-02 17:55 _Zlrrr 阅读(130) 评论(0) 推荐(0)
摘要:https://pintia.cn/problem-sets/994805260223102976/problems/1038429385296453632 以下文字摘自《灵机一动·好玩的数学》:“狼人杀”游戏分为狼人、好人两大阵营。在一局“狼人杀”游戏中,1 号玩家说:“2 号是狼人”,2 号玩家 阅读全文
posted @ 2018-12-02 11:33 _Zlrrr 阅读(928) 评论(0) 推荐(0)