随笔分类 -  online judge:LeetCode

摘要:##苏州大学计算机复试【字符串/数组类习题】 PAT ###1028 人口普查 (20分) 某城镇进行人口普查,得到了全体居民的生日。现请你写个程序,找出镇上最年长和最年轻的人。 这里确保每个输入的日期都是合法的,但不一定是合理的——假设已知镇上没有超过 200 岁的老人,而今天是 2014 年 9 阅读全文
posted @ 2020-05-25 16:12 douzujun 阅读(601) 评论(0) 推荐(0) 编辑
摘要:/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), r 阅读全文
posted @ 2020-02-23 14:35 douzujun 阅读(160) 评论(0) 推荐(0) 编辑
摘要:/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ class Solu 阅读全文
posted @ 2020-02-23 14:07 douzujun 阅读(131) 评论(0) 推荐(0) 编辑
摘要:#include <iostream> #include <cstdlib> #include <cstdio> using namespace std; struct ListNode { int val; ListNode *next; ListNode(int x) : val(x), nex 阅读全文
posted @ 2020-02-23 02:40 douzujun 阅读(140) 评论(0) 推荐(0) 编辑
摘要:/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), r 阅读全文
posted @ 2020-02-23 00:50 douzujun 阅读(102) 评论(0) 推荐(0) 编辑
摘要:/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ class Solu 阅读全文
posted @ 2020-02-22 21:26 douzujun 阅读(121) 评论(0) 推荐(0) 编辑
摘要:Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum. N 阅读全文
posted @ 2019-06-05 16:37 douzujun 阅读(182) 评论(0) 推荐(0) 编辑
摘要: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 dep 阅读全文
posted @ 2019-06-05 16:28 douzujun 阅读(200) 评论(0) 推荐(0) 编辑
摘要:Given a n-ary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest le 阅读全文
posted @ 2019-06-05 16:25 douzujun 阅读(232) 评论(0) 推荐(0) 编辑
摘要:Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest l 阅读全文
posted @ 2019-06-05 16:24 douzujun 阅读(229) 评论(0) 推荐(0) 编辑
摘要:Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree [1,2,2,3,4,4,3] is symmet 阅读全文
posted @ 2019-06-05 16:01 douzujun 阅读(328) 评论(0) 推荐(0) 编辑
摘要:Given a binary tree, return all root-to-leaf paths. Note: A leaf is a node with no children. Example: 阅读全文
posted @ 2019-06-05 15:20 douzujun 阅读(310) 评论(0) 推荐(0) 编辑
摘要:100. Same Tree 100. Same Tree Given two binary trees, write a function to check if they are the same or not. Two binary trees are considered the same 阅读全文
posted @ 2019-05-26 22:14 douzujun 阅读(250) 评论(0) 推荐(0) 编辑
摘要:108. Convert Sorted Array to Binary Search Tree 108. Convert Sorted Array to Binary Search Tree Given an array where elements are sorted in ascending 阅读全文
posted @ 2019-05-26 18:34 douzujun 阅读(425) 评论(0) 推荐(0) 编辑
摘要:538. Convert BST to Greater Tree 538. Convert BST to Greater Tree Given a Binary Search Tree (BST), convert it to a Greater Tree such that every key o 阅读全文
posted @ 2019-05-26 13:03 douzujun 阅读(361) 评论(0) 推荐(0) 编辑
摘要:993. Cousins in Binary Tree 993. Cousins in Binary Tree In a binary tree, the root node is at depth 0, and children of each depth knode are at depth k 阅读全文
posted @ 2019-05-25 16:17 douzujun 阅读(473) 评论(0) 推荐(0) 编辑
摘要:965. Univalued Binary Tree 965. Univalued Binary Tree A binary tree is univalued if every node in the tree has the same value. Return true if and only 阅读全文
posted @ 2019-05-19 13:30 douzujun 阅读(156) 评论(0) 推荐(0) 编辑
摘要:938. Range Sum of BST Given the root node of a binary search tree, return the sum of values of all nodes with value between L and R (inclusive). The b 阅读全文
posted @ 2019-05-19 13:05 douzujun 阅读(287) 评论(0) 推荐(0) 编辑
摘要:#include using namespace std; struct ListNode { int val; ListNode *next; ListNode(int x) : val(x), next(NULL) {} }; class Solution { public: ListNode* reverseBetween(ListNode* head... 阅读全文
posted @ 2019-04-16 00:46 douzujun 阅读(213) 评论(0) 推荐(0) 编辑
摘要:142. Linked List Cycle II 142. Linked List Cycle II Given a linked list, return the node where the cycle begins. If there is no cycle, return null. To 阅读全文
posted @ 2019-04-05 00:44 douzujun 阅读(242) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示