12 2018 档案

摘要:Given two arrays of length m and n with digits 0-9 representing two numbers. Create the maximum number of length k <= m + n from digits of the two. Th 阅读全文 »
posted @ 2018-12-31 21:25 Veritas_des_Liberty 阅读(237) 评论(0) 推荐(0) 编辑
摘要:Given a string which contains only lowercase letters, remove duplicate letters so that every letter appear once and only once. You must make sure your 阅读全文 »
posted @ 2018-12-31 20:22 Veritas_des_Liberty 阅读(201) 评论(0) 推荐(0) 编辑
摘要:There are N children standing in a line. Each child is assigned a rating value. You are giving candies to these children subjected to the following re 阅读全文 »
posted @ 2018-12-31 18:23 Veritas_des_Liberty 阅读(235) 评论(0) 推荐(0) 编辑
摘要:There are N gas stations along a circular route, where the amount of gas at station i is gas[i]. You have a car with an unlimited gas tank and it cost 阅读全文 »
posted @ 2018-12-31 16:46 Veritas_des_Liberty 阅读(229) 评论(0) 推荐(0) 编辑
摘要:描述 给出两个正整数以及四则运算操作符(+ - * /),求运算结果。 输入第一行:正整数a,长度不超过100第二行:四则运算符o,o是“+”,“-”,“*”,“/”中的某一个第三行:正整数b,长度不超过100保证输入不含多余的空格或其它字符输出一行:表达式“a o b”的值。补充说明:1. 减法结 阅读全文 »
posted @ 2018-12-31 10:44 Veritas_des_Liberty 阅读(359) 评论(0) 推荐(0) 编辑
摘要:Starting with an undirected graph (the "original graph") with nodes from 0 to N-1, subdivisions are made to some of the edges. The graph is given as f 阅读全文 »
posted @ 2018-12-30 22:21 Veritas_des_Liberty 阅读(329) 评论(0) 推荐(0) 编辑
摘要:A car travels from a starting position to a destination which is target miles east of the starting position. Along the way, there are gas stations. Ea 阅读全文 »
posted @ 2018-12-30 21:13 Veritas_des_Liberty 阅读(338) 评论(0) 推荐(0) 编辑
摘要:965. Univalued Binary Tree A binary tree is univalued if every node in the tree has the same value. Return true if and only if the given tree is univa 阅读全文 »
posted @ 2018-12-30 13:40 Veritas_des_Liberty 阅读(312) 评论(0) 推荐(0) 编辑
摘要:We are given a 2-dimensional grid. "." is an empty cell, "#" is a wall, "@" is the starting point, ("a", "b", ...) are keys, and ("A", "B", ...) are l 阅读全文 »
posted @ 2018-12-29 21:41 Veritas_des_Liberty 阅读(408) 评论(0) 推荐(0) 编辑
摘要:There are N workers. The i-th worker has a quality[i] and a minimum wage expectation wage[i]. Now we want to hire exactly K workers to form a paid gro 阅读全文 »
posted @ 2018-12-24 22:26 Veritas_des_Liberty 阅读(299) 评论(0) 推荐(0) 编辑
摘要:4w3:第四周程序填空题1 描述 下面程序的输出是: 3+4i 5+6i 请补足Complex类的成员函数。不能加成员变量。 输入无输出3+4i5+6i样例输入 样例输出 Approach: 4w4:第四周程序填空题2 描述 下面的MyInt类只有一个成员变量。MyInt类内部的部分代码被隐藏了。假 阅读全文 »
posted @ 2018-12-23 22:24 Veritas_des_Liberty 阅读(905) 评论(0) 推荐(0) 编辑
摘要:#include using namespace std; class CDemo { private: int n; public: CDemo(int i = 0):n(i){} CDemo& operator++(); CDemo operator++(int); operator int() { return n; } friend ... 阅读全文 »
posted @ 2018-12-23 22:02 Veritas_des_Liberty 阅读(280) 评论(0) 推荐(0) 编辑
摘要:#include #include #include using namespace std; class Complex { public: double real, imag; public: Complex(double r = 0, double i = 0): real(r), imag(i){}; friend ostream& operator>(... 阅读全文 »
posted @ 2018-12-23 21:40 Veritas_des_Liberty 阅读(682) 评论(0) 推荐(0) 编辑
摘要:Your car starts at position 0 and speed +1 on an infinite number line. (Your car can go into negative positions.) Your car drives automatically accord 阅读全文 »
posted @ 2018-12-23 18:57 Veritas_des_Liberty 阅读(326) 评论(0) 推荐(0) 编辑
摘要:961. N-Repeated Element in Size 2N Array In a array A of size 2N, there are N+1 unique elements, and exactly one of these elements is repeated N times 阅读全文 »
posted @ 2018-12-23 12:57 Veritas_des_Liberty 阅读(247) 评论(0) 推荐(0) 编辑
摘要:There are n cities connected by m flights. Each fight starts from city u and arrives at v with a price w. Now given all the cities and flights, togeth 阅读全文 »
posted @ 2018-12-22 13:05 Veritas_des_Liberty 阅读(302) 评论(0) 推荐(0) 编辑
摘要:There are N network nodes, labelled 1 to N. Given times, a list of travel times as directed edges times[i] = (u, v, w), where u is the source node, v  阅读全文 »
posted @ 2018-12-22 12:10 Veritas_des_Liberty 阅读(310) 评论(0) 推荐(0) 编辑
摘要:Given a non-empty list of words, return the k most frequent elements. Your answer should be sorted by frequency from highest to lowest. If two words h 阅读全文 »
posted @ 2018-12-21 18:37 Veritas_des_Liberty 阅读(325) 评论(0) 推荐(0) 编辑
摘要:You are given an integer array sorted in ascending order (may contain duplicates), you need to split them into several subsequences, where each subseq 阅读全文 »
posted @ 2018-12-21 17:59 Veritas_des_Liberty 阅读(224) 评论(0) 推荐(0) 编辑
摘要:Suppose LeetCode will start its IPO soon. In order to sell a good price of its shares to Venture Capital, LeetCode would like to work on some projects 阅读全文 »
posted @ 2018-12-20 22:06 Veritas_des_Liberty 阅读(361) 评论(0) 推荐(0) 编辑
摘要:Given an m x n matrix of positive integers representing the height of each unit cell in a 2D elevation map, compute the volume of water it is able to 阅读全文 »
posted @ 2018-12-20 18:20 Veritas_des_Liberty 阅读(225) 评论(0) 推荐(0) 编辑
摘要:#include #include class CArray { int size; int *ptr; public: CArray(int s = 0); CArray(CArray& a); ~CArray(); void push_back(int v); CArray& operator=(const CArray& a)... 阅读全文 »
posted @ 2018-12-20 17:51 Veritas_des_Liberty 阅读(589) 评论(0) 推荐(0) 编辑
摘要:You are given two integer arrays nums1 and nums2 sorted in ascending order and an integer k. Define a pair (u,v) which consists of one element from th 阅读全文 »
posted @ 2018-12-19 20:42 Veritas_des_Liberty 阅读(241) 评论(0) 推荐(0) 编辑
摘要:Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element. Example 阅读全文 »
posted @ 2018-12-19 17:25 Veritas_des_Liberty 阅读(202) 评论(0) 推荐(0) 编辑
摘要:描述 魔兽世界的西面是红魔军的司令部,东面是蓝魔军的司令部。两个司令部之间是依次排列的若干城市。 红司令部,City 1,City 2,……,City n,蓝司令部两军的司令部都会制造武士。武士一共有 dragon 、ninja、iceman、lion、wolf 五种。每种武士都有编号、生命值、攻击 阅读全文 »
posted @ 2018-12-19 16:11 Veritas_des_Liberty 阅读(737) 评论(0) 推荐(0) 编辑
摘要:A city's skyline is the outer contour of the silhouette formed by all the buildings in that city when viewed from a distance. Now suppose you are give 阅读全文 »
posted @ 2018-12-18 22:30 Veritas_des_Liberty 阅读(213) 评论(0) 推荐(0) 编辑
摘要:3w6:第三周程序填空题1 描述 下面程序输出的结果是: 4,6 请填空: 输入无输出4,6样例输入 样例输出 Code: 3w7:第三周程序填空题2 描述 下面程序输出的结果是: 0 5 请填空: 输入无输出05样例输入 样例输出 提示所缺代码具有如下形式: Code: 3w8:第三周程序填空题3 阅读全文 »
posted @ 2018-12-18 12:44 Veritas_des_Liberty 阅读(1136) 评论(0) 推荐(0) 编辑
摘要:Given an array nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k num 阅读全文 »
posted @ 2018-12-18 11:03 Veritas_des_Liberty 阅读(213) 评论(0) 推荐(0) 编辑
摘要:Write a program to find the nth super ugly number. Super ugly numbers are positive numbers whose all prime factors are in the given prime list primes  阅读全文 »
posted @ 2018-12-18 09:17 Veritas_des_Liberty 阅读(256) 评论(0) 推荐(0) 编辑
摘要:Median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean of the two 阅读全文 »
posted @ 2018-12-17 22:39 Veritas_des_Liberty 阅读(457) 评论(0) 推荐(0) 编辑
摘要:Write a program to find the n-th ugly number. Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. Example: Input: n = 10 Outpu 阅读全文 »
posted @ 2018-12-17 21:06 Veritas_des_Liberty 阅读(176) 评论(0) 推荐(0) 编辑
摘要:Given a list of words (without duplicates), please write a program that returns all concatenated words in the given list of words. A concatenated word 阅读全文 »
posted @ 2018-12-16 17:58 Veritas_des_Liberty 阅读(331) 评论(0) 推荐(0) 编辑
摘要:958. Check Completeness of a Binary Tree Given a binary tree, determine if it is a complete binary tree. Definition of a complete binary tree from Wik 阅读全文 »
posted @ 2018-12-16 12:53 Veritas_des_Liberty 阅读(216) 评论(0) 推荐(0) 编辑
摘要:Given an m x n matrix of non-negative integers representing the height of each unit cell in a continent, the "Pacific ocean" touches the left and top 阅读全文 »
posted @ 2018-12-15 22:21 Veritas_des_Liberty 阅读(242) 评论(0) 推荐(0) 编辑
摘要:There are a total of n courses you have to take, labeled from 0 to n-1. Some courses may have prerequisites, for example to take course 0 you have to 阅读全文 »
posted @ 2018-12-14 21:28 Veritas_des_Liberty 阅读(188) 评论(0) 推荐(0) 编辑
摘要:There are a total of n courses you have to take, labeled from 0 to n-1. Some courses may have prerequisites, for example to take course 0 you have to 阅读全文 »
posted @ 2018-12-13 21:33 Veritas_des_Liberty 阅读(211) 评论(0) 推荐(0) 编辑
摘要:描述 在一个学生信息处理程序中,要求实现一个代表学生的类,并且所有成员变量都应该是私有的。 (注:评测系统无法自动判断变量是否私有。我们会在结束之后统一对作业进行检查,请同学们严格按照题目要求完成,否则可能会影响作业成绩。) 输入姓名,年龄,学号,第一学年平均成绩,第二学年平均成绩,第三学年平均成绩 阅读全文 »
posted @ 2018-12-13 20:25 Veritas_des_Liberty 阅读(873) 评论(0) 推荐(0) 编辑
摘要:Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST. For this problem, a height-balanced bina 阅读全文 »
posted @ 2018-12-12 18:12 Veritas_des_Liberty 阅读(177) 评论(0) 推荐(0) 编辑
摘要:Given a binary tree, return all root-to-leaf paths. Note: A leaf is a node with no children. Example: Approach #1: C++. [recursive] Approach #2: Java. 阅读全文 »
posted @ 2018-12-11 21:51 Veritas_des_Liberty 阅读(161) 评论(0) 推荐(0) 编辑
摘要:The thief has found himself a new place for his thievery again. There is only one entrance to this area, called the "root." Besides the root, each hou 阅读全文 »
posted @ 2018-12-11 20:39 Veritas_des_Liberty 阅读(217) 评论(0) 推荐(0) 编辑
摘要:Given a list of airline tickets represented by pairs of departure and arrival airports [from, to], reconstruct the itinerary in order. All of the tick 阅读全文 »
posted @ 2018-12-11 16:51 Veritas_des_Liberty 阅读(236) 评论(0) 推荐(0) 编辑
摘要:Given an integer matrix, find the length of the longest increasing path. From each cell, you can either move to four directions: left, right, up or do 阅读全文 »
posted @ 2018-12-11 13:11 Veritas_des_Liberty 阅读(232) 评论(0) 推荐(0) 编辑
摘要:Remove the minimum number of invalid parentheses in order to make the input string valid. Return all possible results. Note: The input string may cont 阅读全文 »
posted @ 2018-12-10 21:58 Veritas_des_Liberty 阅读(208) 评论(0) 推荐(0) 编辑
摘要:Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom. Example 阅读全文 »
posted @ 2018-12-10 18:00 Veritas_des_Liberty 阅读(205) 评论(0) 推荐(0) 编辑
摘要:Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number. An example is the root-to-leaf path 1->2->3 whic 阅读全文 »
posted @ 2018-12-10 17:15 Veritas_des_Liberty 阅读(195) 评论(0) 推荐(0) 编辑
摘要:Given a non-empty binary tree, find the maximum path sum. For this problem, a path is defined as any sequence of nodes from some starting node to any 阅读全文 »
posted @ 2018-12-10 12:05 Veritas_des_Liberty 阅读(191) 评论(0) 推荐(0) 编辑
摘要:Given a binary tree, flatten it to a linked list in-place. For example, given the following tree: The flattened tree should look like: Approach #1: C+ 阅读全文 »
posted @ 2018-12-10 10:11 Veritas_des_Liberty 阅读(162) 评论(0) 推荐(0) 编辑
摘要:Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum. Note: A leaf is a node with no children. Exampl 阅读全文 »
posted @ 2018-12-09 21:13 Veritas_des_Liberty 阅读(202) 评论(0) 推荐(0) 编辑
摘要:Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest l 阅读全文 »
posted @ 2018-12-09 18:53 Veritas_des_Liberty 阅读(182) 评论(0) 推荐(0) 编辑
摘要:Two elements of a binary search tree (BST) are swapped by mistake. Recover the tree without changing its structure. Example 1: Input: [1,3,null,null,2 阅读全文 »
posted @ 2018-12-09 18:14 Veritas_des_Liberty 阅读(215) 评论(0) 推荐(0) 编辑
摘要:955. Delete Columns to Make Sorted II We are given an array A of N lowercase letter strings, all of the same length. Now, we may choose any set of del 阅读全文 »
posted @ 2018-12-09 17:02 Veritas_des_Liberty 阅读(260) 评论(0) 推荐(0) 编辑
摘要:Given an integer n, generate all structurally unique BST's (binary search trees) that store values 1 ... n. Example: Input: 3 Output: [ [1,null,3,2], 阅读全文 »
posted @ 2018-12-08 21:40 Veritas_des_Liberty 阅读(219) 评论(0) 推荐(0) 编辑
摘要: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 binary search tree is g 阅读全文 »
posted @ 2018-12-04 12:27 Veritas_des_Liberty 阅读(663) 评论(0) 推荐(0) 编辑
摘要:Given a Binary Search Tree (BST) with the root node root, return the minimum difference between the values of any two different nodes in the tree. Exa 阅读全文 »
posted @ 2018-12-04 11:59 Veritas_des_Liberty 阅读(254) 评论(0) 推荐(0) 编辑
摘要:Implement a MyCalendarThree class to store your events. A new event can always be added. Your class will have one method, book(int start, int end). Fo 阅读全文 »
posted @ 2018-12-03 19:14 Veritas_des_Liberty 阅读(323) 评论(0) 推荐(0) 编辑
摘要:Implement a MyCalendarTwo class to store your events. A new event can be added if adding the event will not cause a triple booking. Your class will ha 阅读全文 »
posted @ 2018-12-03 17:27 Veritas_des_Liberty 阅读(495) 评论(0) 推荐(0) 编辑
摘要:949. Largest Time for Given Digits (string::compare) Given an array of 4 digits, return the largest 24 hour time that can be made. The smallest 24 hou 阅读全文 »
posted @ 2018-12-02 12:55 Veritas_des_Liberty 阅读(229) 评论(0) 推荐(0) 编辑
摘要:int rangeMinQuery(int segTree[], int qlow, int qhigh, int low, int high, int pos) { if (qlow = high) return segTree[pos]; if (qlow > high || qhigh < low) return maxVal; i... 阅读全文 »
posted @ 2018-12-01 22:20 Veritas_des_Liberty 阅读(217) 评论(0) 推荐(0) 编辑
摘要:On an infinite number line (x-axis), we drop given squares in the order they are given. The i-th square dropped (positions[i] = (left, side_length)) i 阅读全文 »
posted @ 2018-12-01 18:15 Veritas_des_Liberty 阅读(446) 评论(0) 推荐(0) 编辑
摘要:Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child i has a g 阅读全文 »
posted @ 2018-12-01 17:17 Veritas_des_Liberty 阅读(173) 评论(0) 推荐(0) 编辑
摘要:A Range Module is a module that tracks ranges of numbers. Your task is to design and implement the following interfaces in an efficient manner. addRan 阅读全文 »
posted @ 2018-12-01 12:38 Veritas_des_Liberty 阅读(363) 评论(0) 推荐(0) 编辑
摘要:Given a binary search tree with non-negative values, find the minimum absolute difference between values of any two nodes. Example: Input: 1 \ 3 / 2 O 阅读全文 »
posted @ 2018-12-01 11:04 Veritas_des_Liberty 阅读(294) 评论(0) 推荐(0) 编辑

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