随笔分类 -  算法题

上一页 1 2 3 4 5 6 ··· 16 下一页
摘要:Given a matrix of M x N elements (M rows, N columns), return all elements of the matrix in diagonal order as shown in the below image. Example: Note: 阅读全文
posted @ 2018-08-16 14:59 Pickle 阅读(330) 评论(0) 推荐(0)
摘要:Given a circular array (the next element of the last element is the first element of the array), print the Next Greater Number for every element. The 阅读全文
posted @ 2018-08-16 14:58 Pickle 阅读(188) 评论(0) 推荐(0)
摘要:You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. Find all the next greater numbers for nums1' 阅读全文
posted @ 2018-08-16 14:57 Pickle 阅读(128) 评论(0) 推荐(0)
摘要:Consider all the leaves of a binary tree. From left to right order, the values of those leaves form a leaf value sequence. For example, in the given t 阅读全文
posted @ 2018-07-26 10:36 Pickle 阅读(528) 评论(0) 推荐(0)
摘要:Given an integer n, return 1 - n in lexicographical order. For example, given 13, return: [1,10,11,12,13,2,3,4,5,6,7,8,9]. Please optimize your algori 阅读全文
posted @ 2018-07-12 17:13 Pickle 阅读(237) 评论(0) 推荐(0)
摘要:On a horizontal number line, we have gas stations at positions stations[0], stations[1], ..., stations[N-1], where N = stations.length. Now, we add K  阅读全文
posted @ 2018-03-26 16:40 Pickle 阅读(528) 评论(0) 推荐(0)
摘要:Given a Binary Search Tree (BST) with root node root, and a target value V, split the tree into two subtrees where one subtree has nodes that are all 阅读全文
posted @ 2018-02-07 17:48 Pickle 阅读(1068) 评论(0) 推荐(0)
摘要:You are given a data structure of employee information, which includes the employee's unique id, his importance value and his directsubordinates' id. 阅读全文
posted @ 2018-01-18 19:37 Pickle 阅读(264) 评论(0) 推荐(0)
摘要:A self-dividing number is a number that is divisible by every digit it contains. For example, 128 is a self-dividing number because 128 % 1 == 0, 128 阅读全文
posted @ 2017-12-05 11:05 Pickle 阅读(460) 评论(0) 推荐(0)
摘要:Given a string and an integer k, you need to reverse the first k characters for every 2k characters counting from the start of the string. If there ar 阅读全文
posted @ 2017-10-22 17:05 Pickle 阅读(187) 评论(0) 推荐(0)
摘要:You are given a string representing an attendance record for a student. The record only contains the following three characters: A student could be re 阅读全文
posted @ 2017-10-19 10:43 Pickle 阅读(167) 评论(0) 推荐(0)
摘要:The Employee table holds all employees. Every employee has an Id, and there is also a column for the department Id. The Department table holds all dep 阅读全文
posted @ 2017-09-18 18:16 Pickle 阅读(368) 评论(0) 推荐(0)
摘要:X city built a new stadium, each day many people visit it and the stats are saved as these columns: id, date, people Please write a query to display t 阅读全文
posted @ 2017-09-14 14:03 Pickle 阅读(1407) 评论(0) 推荐(0)
摘要:Mary is a teacher in a middle school and she has a table seat storing students' names and their corresponding seat ids. The column id is continuous in 阅读全文
posted @ 2017-09-14 13:50 Pickle 阅读(1087) 评论(0) 推荐(0)
摘要:There is a table courses with columns: student and class Please list out all classes which have more than or equal to 5 students. For example, the tab 阅读全文
posted @ 2017-09-13 19:34 Pickle 阅读(359) 评论(0) 推荐(0)
摘要:X city opened a new cinema, many people would like to go to this cinema. The cinema also gives out a poster indicating the movies’ ratings and descrip 阅读全文
posted @ 2017-09-13 18:49 Pickle 阅读(303) 评论(0) 推荐(0)
摘要:Given a table salary, such as the one below, that has m=male and f=female values. Swap all f and m values (i.e., change all f values to m and vice ver 阅读全文
posted @ 2017-09-13 18:42 Pickle 阅读(365) 评论(0) 推荐(0)
摘要: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 contai 阅读全文
posted @ 2017-09-01 18:18 Pickle 阅读(185) 评论(0) 推荐(0)
摘要:You are given two non-empty linked lists representing two non-negative integers. The most significant digit comes first and each of their nodes contai 阅读全文
posted @ 2017-09-01 18:00 Pickle 阅读(233) 评论(0) 推荐(0)
摘要:Given an m * n matrix M initialized with all 0's and several update operations. Operations are represented by a 2D array, and each operation is repres 阅读全文
posted @ 2017-09-01 11:39 Pickle 阅读(294) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 ··· 16 下一页