随笔分类 -  algorithm

上一页 1 2 3 4 5 6 7 8 9 ··· 13 下一页
摘要:Given an array of numbers, verify whether it is the correct preorder traversal sequence of a binary search tree. You may assume each number in the seq 阅读全文
posted @ 2017-12-19 06:34 逸朵 阅读(175) 评论(0) 推荐(0)
摘要:Numbers can be regarded as product of its factors. For example, 8 = 2 x 2 x 2; = 2 x 4. Write a function that takes an integer n and return all possib 阅读全文
posted @ 2017-12-19 05:11 逸朵 阅读(130) 评论(0) 推荐(0)
摘要:Given an array of meeting time intervals consisting of start and end times [[s1,e1],[s2,e2],...] (si < ei), find the minimum number of conference room 阅读全文
posted @ 2017-12-19 03:54 逸朵 阅读(448) 评论(0) 推荐(0)
摘要:Given an array of meeting time intervals consisting of start and end times [[s1,e1],[s2,e2],...] (si < ei), determine if a person could attend all mee 阅读全文
posted @ 2017-12-19 03:06 逸朵 阅读(146) 评论(0) 推荐(0)
摘要:Given a binary tree, count the number of uni-value subtrees. A Uni-value subtree means all nodes of the subtree have the same value. For example:Given 阅读全文
posted @ 2017-12-19 02:52 逸朵 阅读(187) 评论(0) 推荐(0)
摘要:Given a string, we can "shift" each of its letter to its successive letter, for example: "abc" -> "bcd". We can keep "shifting" which forms the sequen 阅读全文
posted @ 2017-12-19 01:43 逸朵 阅读(219) 评论(0) 推荐(0)
摘要:A strobogrammatic number is a number that looks the same when rotated 180 degrees (looked at upside down). Write a function to count the total strobog 阅读全文
posted @ 2017-12-18 13:09 逸朵 阅读(312) 评论(0) 推荐(0)
摘要:A strobogrammatic number is a number that looks the same when rotated 180 degrees (looked at upside down). Find all strobogrammatic numbers that are o 阅读全文
posted @ 2017-12-18 12:57 逸朵 阅读(233) 评论(0) 推荐(0)
摘要:A strobogrammatic number is a number that looks the same when rotated 180 degrees (looked at upside down). Write a function to determine if a number i 阅读全文
posted @ 2017-12-18 12:21 逸朵 阅读(240) 评论(0) 推荐(0)
摘要:This is a follow up of Shortest Word Distance. The only difference is now you are given the list of words and your method will be called repeatedly ma 阅读全文
posted @ 2017-12-18 10:37 逸朵 阅读(335) 评论(0) 推荐(0)
摘要:Given a list of words and two words word1 and word2, return the shortest distance between these two words in the list. For example,Assume that words = 阅读全文
posted @ 2017-12-18 10:33 逸朵 阅读(224) 评论(0) 推荐(0)
摘要:Given a sorted integer array where the range of elements are in the inclusive range [lower, upper], return its missing ranges. For example, given [0, 阅读全文
posted @ 2017-12-18 10:11 逸朵 阅读(131) 评论(0) 推荐(0)
摘要:Given two strings S and T, determine if they are both one edit distance apart. 阅读全文
posted @ 2017-12-18 09:45 逸朵 阅读(192) 评论(0) 推荐(0)
摘要:Given a string, find the length of the longest substring T that contains at most 2 distinct characters. For example, Given s = “eceba”, T is "ece" whi 阅读全文
posted @ 2017-12-18 08:21 逸朵 阅读(130) 评论(0) 推荐(0)
摘要:The API: int read4(char *buf) reads 4 characters at a time from a file. The return value is the actual number of characters read. For example, it retu 阅读全文
posted @ 2017-12-18 07:54 逸朵 阅读(185) 评论(0) 推荐(0)
摘要:The API: int read4(char *buf) reads 4 characters at a time from a file. The return value is the actual number of characters read. For example, it retu 阅读全文
posted @ 2017-12-18 07:41 逸朵 阅读(156) 评论(0) 推荐(0)
摘要:Given a binary tree where all the right nodes are either leaf nodes with a sibling (a left node that shares the same parent node) or empty, flip it up 阅读全文
posted @ 2017-12-18 06:56 逸朵 阅读(235) 评论(0) 推荐(0)
摘要:There is a new alien language which uses the latin alphabet. However, the order among letters are unknown to you. You receive a list of non-empty word 阅读全文
posted @ 2017-12-18 04:05 逸朵 阅读(507) 评论(0) 推荐(0)
摘要:There is a fence with n posts, each post can be painted with one of the k colors. You have to paint all the posts such that no more than two adjacent 阅读全文
posted @ 2017-12-18 02:15 逸朵 阅读(239) 评论(0) 推荐(0)
摘要:Given two sparse matrices A and B, return the result of AB. You may assume that A's column number is equal to B's row number. Example: 阅读全文
posted @ 2017-12-18 01:28 逸朵 阅读(268) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 7 8 9 ··· 13 下一页