随笔分类 -  LeetCode

上一页 1 ··· 19 20 21 22 23 24 25 26 27 ··· 61 下一页
摘要:Design your implementation of the circular queue. The circular queue is a linear data structure in which the operations are performed based on FIFO (F 阅读全文
posted @ 2018-11-02 23:08 Grandyang 阅读(6118) 评论(4) 推荐(1) 编辑
摘要:Given an n-ary tree, return the preorder traversal of its nodes' values. For example, given a 3-ary tree: Return its preorder traversal as: [1,3,5,6,2 阅读全文
posted @ 2018-10-31 10:48 Grandyang 阅读(3378) 评论(1) 推荐(1) 编辑
摘要:Given an n-ary tree, return the postorder traversal of its nodes' values. For example, given a 3-ary tree: Return its postorder traversal as: [5,6,3,2 阅读全文
posted @ 2018-10-31 10:11 Grandyang 阅读(2482) 评论(2) 推荐(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 @ 2018-10-29 21:41 Grandyang 阅读(3487) 评论(3) 推荐(0) 编辑
摘要:A quadtree is a tree data in which each internal node has exactly four children: topLeft, topRight, bottomLeft and bottomRight. Quad trees are often u 阅读全文
posted @ 2018-10-24 23:44 Grandyang 阅读(2070) 评论(0) 推荐(0) 编辑
摘要:Given an array w of positive integers, where w[i] describes the weight of index i, write a function pickIndex which randomly picks an index in proport 阅读全文
posted @ 2018-10-13 23:05 Grandyang 阅读(12953) 评论(5) 推荐(1) 编辑
摘要:You are given the number of rows n_rows and number of columns n_cols of a 2D binary matrix where all values are initially 0. Write a function flip whi 阅读全文
posted @ 2018-10-12 23:32 Grandyang 阅读(3393) 评论(2) 推荐(0) 编辑
摘要:Given a list of non-overlapping axis-aligned rectangles rects, write a function pick which randomly and uniformily picks an integer point in the space 阅读全文
posted @ 2018-10-07 23:54 Grandyang 阅读(4203) 评论(7) 推荐(0) 编辑
摘要:Given the radius and x-y positions of the center of a circle, write a function randPoint which generates a uniform random point in the circle. Note: E 阅读全文
posted @ 2018-10-03 23:09 Grandyang 阅读(4157) 评论(6) 推荐(0) 编辑
摘要:Given a function rand7 which generates a uniform random integer in the range 1 to 7, write a function rand10 which generates a uniform random integer 阅读全文
posted @ 2018-09-30 00:00 Grandyang 阅读(7262) 评论(0) 推荐(1) 编辑
摘要:You are given a doubly linked list which in addition to the next and previous pointers, it could have a child pointer, which may or may not point to a 阅读全文
posted @ 2018-09-21 21:24 Grandyang 阅读(6126) 评论(5) 推荐(0) 编辑
摘要:Given an n-ary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level). For example, given a 3-ary tree: 阅读全文
posted @ 2018-09-18 23:59 Grandyang 阅读(3611) 评论(0) 推荐(0) 编辑
摘要:We want to use quad trees to store an N x N boolean grid. Each cell in the grid can only be true or false. The root node represents the whole grid. Fo 阅读全文
posted @ 2018-09-14 22:46 Grandyang 阅读(5330) 评论(0) 推荐(0) 编辑
摘要:Convert a BST to a sorted circular doubly-linked list in-place. Think of the left and right pointers as synonymous to the previous and next pointers i 阅读全文
posted @ 2018-09-09 23:34 Grandyang 阅读(11141) 评论(1) 推荐(1) 编辑
摘要:You are given the head of a linked list containing unique integer values and an integer array nums that is a subset of the linked list values. Return  阅读全文
posted @ 2018-09-06 21:56 Grandyang 阅读(6496) 评论(0) 推荐(1) 编辑
摘要:We had some 2-dimensional coordinates, like "(1, 3)" or "(2, 0.5)". Then, we removed all commas, decimal points, and spaces, and ended up with the str 阅读全文
posted @ 2018-08-30 23:56 Grandyang 阅读(2777) 评论(0) 推荐(1) 编辑
摘要:We are given the head node root of a binary tree, where additionally every node's value is either a 0 or a 1. Return the same tree where every subtree 阅读全文
posted @ 2018-08-26 23:45 Grandyang 阅读(3830) 评论(2) 推荐(1) 编辑
摘要:We partition a row of numbers A into at most K adjacent (non-empty) groups, then our score is the sum of the average of each group. What is the larges 阅读全文
posted @ 2018-08-20 11:05 Grandyang 阅读(4715) 评论(2) 推荐(0) 编辑
摘要:A website domain like "discuss.leetcode.com" consists of various subdomains. At the top level, we have "com", at the next level, we have "leetcode.com 阅读全文
posted @ 2018-08-16 11:01 Grandyang 阅读(3135) 评论(0) 推荐(0) 编辑
摘要:You have a list of points in the plane. Return the area of the largest triangle that can be formed by any 3 of the points. Notes: 3 <= points.length < 阅读全文
posted @ 2018-08-11 23:00 Grandyang 阅读(3554) 评论(0) 推荐(0) 编辑

上一页 1 ··· 19 20 21 22 23 24 25 26 27 ··· 61 下一页
Fork me on GitHub