算法每日一练
算法练习
梓莘
zero-->hero 理性+理智。记住一句话:越努力,越幸运。犯其至难,图其至远。努力规划,实现自我。↖(^ω^)↗
展开
-
【算法每日一练】 PAT 甲级1099 Build A Binary Search Tree java
A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:The left subtree of a node contains only nodes with keys less than the node’s key.The right sub...原创 2020-04-15 19:52:04 · 272 阅读 · 0 评论 -
【算法每日一练】PAT甲级1043 java
A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:The left subtree of a node contains only nodes with keys less than the node’s key.The right sub...原创 2020-04-15 17:16:11 · 148 阅读 · 0 评论 -
【算法每日一练】PAT甲级 1086 java
An inorder binary tree traversal can be implemented in a non-recursive way with a stack. For example, suppose that when a 6-node binary tree (with the keys numbered from 1 to 6) is traversed, the stac...原创 2020-04-11 23:04:02 · 138 阅读 · 0 评论 -
【算法每日一练】 PAT甲级 1020 Java
Suppose that all the keys in a binary tree are distinct positive integers. Given the postorder and inorder traversal sequences, you are supposed to output the level order traversal sequence of the cor...原创 2020-04-11 22:29:59 · 226 阅读 · 0 评论 -
【算法每日一练】PAT甲级1052 java
A linked list consists of a series of structures, which are not necessarily adjacent in memory. We assume that each structure contains an integer key and a Next pointer to the next structure. Now give...原创 2020-04-07 17:53:34 · 167 阅读 · 0 评论 -
【算法每日一练】PAT甲级 1032 java 一个超时
1032 Sharing (25分)To store English words, one method is to use linked lists and store a word letter by letter. To save some space, we may let the words share the same sublist if they share the same s...原创 2020-04-07 09:55:27 · 187 阅读 · 0 评论 -
【算法每日一练】PAT 甲级 1056 有超时 java
1056 Mice and Rice (25分)Mice and Rice is the name of a programming contest in which each programmer must write a piece of code to control the movements of a mouse in a given map. The goal of each mou...原创 2020-04-07 09:30:06 · 198 阅读 · 0 评论 -
【算法每日一练】PAT甲级 1051 java
Given a stack which can keep M numbers at most. Push N numbers in the order of 1, 2, 3, …, N and pop randomly. You are supposed to tell if a given sequence of numbers is a possible pop sequence of the...原创 2020-04-06 15:49:42 · 235 阅读 · 0 评论 -
【算法每日一练】PAT甲级 1024 java
1024 Palindromic Number (25分)Notice that the number 123456789 is a 9-digit number consisting exactly the numbers from 1 to 9, with no duplication. Double it we will obtain 246913578, which happens to...原创 2020-04-06 12:42:27 · 259 阅读 · 0 评论 -
【算法每日一练】PAT甲级 1059 java
1059 Prime Factors (25分)Given any positive integer N, you are supposed to find all of its prime factors, and write them in the format N = p1k1×p2k2×⋯×pmk**m.Input Specification:Each input file cont...原创 2020-04-06 11:59:35 · 92 阅读 · 0 评论 -
【算法每日一练】PAT甲级 1096 java
1096 Consecutive Factors (20分)Among all the factors of a positive integer N, there may exist several consecutive numbers. For example, 630 can be factored as 3×5×6×7, where 5, 6, and 7 are the three ...原创 2020-04-06 10:56:49 · 173 阅读 · 0 评论 -
【算法每日一练】PAT甲级 1080 java待改进
1080 Graduate Admission (30分)It is said that in 2011, there are about 100 graduate schools ready to proceed over 40,000 applications in Zhejiang Province. It would help a lot if you could write a pro...原创 2020-04-04 15:58:37 · 138 阅读 · 0 评论 -
【算法每日一练】PAT 甲级1083 java
1083 List Grades (25分)Given a list of N student records with name, ID and grade. You are supposed to sort the records with respect to the grade in non-increasing order, and output those student recor...原创 2020-04-04 12:03:27 · 136 阅读 · 0 评论 -
【算法每日一练】PAT甲级 1075 java 待重新优化
The ranklist of PAT is generated from the status list, which shows the scores of the submissions. This time you are supposed to generate the ranklist for PAT.Input Specification:Each input file cont...原创 2020-04-04 11:37:59 · 122 阅读 · 0 评论 -
【算法每日一练】LeetCode02-两数相加 java
题目 LeetCode02 两数相加给出两个 非空 的链表用来表示两个非负的整数。其中,它们各自的位数是按照 逆序 的方式存储的,并且它们的每个节点只能存储 一位 数字。如果,我们将这两个数相加起来,则会返回一个新的链表来表示它们的和。您可以假设除了数字 0 之外,这两个数都不会以 0 开头。示例:输入:(2 -> 4 -> 3) + (5 -> 6 -> 4)...原创 2020-03-30 17:44:49 · 142 阅读 · 0 评论 -
【算法每日一练】LeetCode01-两数之和 java
题目 LeetCode 01 两数之和给定一个整数数组 nums 和一个目标值 target,请你在该数组中找出和为目标值的那 两个 整数,并返回他们的数组下标。你可以假设每种输入只会对应一个答案。但是,你不能重复利用这个数组中同样的元素。示例:给定 nums = [2, 7, 11, 15], target = 9因为 nums[0] + nums[1] = 2 + 7 = 9所以返...原创 2020-03-30 17:11:32 · 137 阅读 · 0 评论