编程题
ygtrece
这个作者很懒,什么都没留下…
展开
-
LeetCode#33 Search in Rotated Sorted Array
题目Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.(i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]).You are given a target value to search. If found...原创 2020-03-02 21:16:24 · 162 阅读 · 0 评论 -
LeetCode#402 Remove K Digits
题目Given a non-negative integer num represented as a string, remove k digits from the number so that the new number is the smallest possible.Note:The length of num is less than 10002 and will be ≥ k...原创 2020-02-09 00:03:26 · 138 阅读 · 0 评论 -
LeetCode#99 Recover Binary Search Tree
题目Two elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Follow up:A solution using O(n) space is pretty straight forward.Could you de...原创 2020-02-08 23:55:41 · 184 阅读 · 0 评论 -
2019年中山大学数据科学与计算机学院研究生统考机试
2019年中山大学数据科学与计算机学院研究生统考复试机试本人参加了2019年中山大学数据科学与计算机学院研究生考试,现已上岸,写下这篇博客大致回忆复试机考题目,希望能对以后的同学有所帮助。机试共十道题。1. 继承一共有3个类,animal, cat, dog,cat和dog继承animal,在创建实例对象时使用d = new dog()或 c = new cat(),要求完成相关函数定义,...原创 2019-06-01 17:19:08 · 6471 阅读 · 14 评论 -
LeetCode#46 Permutations (week6)
week6题目Given a collection of distinct numbers, return all possible permutations.For example, [1,2,3] have the following permutations: [ [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2]原创 2017-10-15 00:52:39 · 207 阅读 · 0 评论 -
LeetCode#230 Kth Smallest Element in a BST (week7)
week7题目Given a binary search tree, write a function kthSmallest to find the kth smallest element in it.Note: You may assume k is always valid, 1 ≤ k ≤ BST’s total elements.Follow up: What if the BST原创 2017-10-21 10:48:38 · 189 阅读 · 0 评论 -
LeetCode#228 Summary Ranges (week7)
week7题目Given a sorted integer array without duplicates, return the summary of its ranges.Example 1: Input: [0,1,2,4,5,7] Output: [“0->2”,”4->5”,”7”] Example 2: Input: [0,2,3,4,6,8,9] Output: [“0”,原创 2017-10-20 17:40:57 · 154 阅读 · 0 评论 -
LeetCode#263 Ugly Number (week8)
week8题目Write a program to check whether a given number is an ugly number.Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 6, 8 are ugly while 14 is not ugly sinc原创 2017-10-27 23:43:17 · 147 阅读 · 0 评论 -
LeetCode#86 Partition List (week4)
week4(problem2)题目Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x.You should preserve the original relative order of the node原创 2017-09-30 18:27:31 · 182 阅读 · 0 评论 -
LeetCode#74 Search a 2D Matrix(week4)
week4题目Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted from left to right. The first integer of each原创 2017-09-30 17:18:33 · 156 阅读 · 0 评论 -
LeetCode#242 Valid Anagram (week5)
week5题目Given two strings s and t, write a function to determine if t is an anagram of s.For example, s = “anagram”, t = “nagaram”, return true. s = “rat”, t = “car”, return false.Note: You may assum原创 2017-10-07 21:31:56 · 185 阅读 · 0 评论 -
LeetCode#5 Longest Palindromic Substring (week3)
week3题目Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.Example: Input: “babad” Output: “bab” Note: “aba” is also a valid answer.Exa原创 2017-09-20 23:37:57 · 249 阅读 · 0 评论 -
LeetCode#2 Add Two Numbers (week2)
week2题目You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and re原创 2017-09-16 14:18:30 · 216 阅读 · 0 评论