随笔分类 -  algorithm

上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 13 下一页
摘要:Follow up for H-Index: What if the citations array is sorted in ascending order? Could you optimize your algorithm? 阅读全文
posted @ 2017-12-07 02:44 逸朵 阅读(119) 评论(0) 推荐(0)
摘要:Given an array of citations (each citation is a non-negative integer) of a researcher, write a function to compute the researcher's h-index. According 阅读全文
posted @ 2017-12-07 02:40 逸朵 阅读(160) 评论(0) 推荐(0)
摘要:Convert a non-negative integer to its english words representation. Given input is guaranteed to be less than 231 - 1. For example, 123 -> "One Hundre 阅读全文
posted @ 2017-12-07 01:59 逸朵 阅读(120) 评论(0) 推荐(0)
摘要:Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. Example 1 Example 2 阅读全文
posted @ 2017-12-06 13:06 逸朵 阅读(103) 评论(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. For example, 1, 2, 3, 4, 5, 阅读全文
posted @ 2017-12-06 12:31 逸朵 阅读(139) 评论(0) 推荐(0)
摘要: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 exa 阅读全文
posted @ 2017-12-06 12:11 逸朵 阅读(113) 评论(0) 推荐(0)
摘要:Given a binary tree, return all root-to-leaf paths. For example, given the following binary tree: All root-to-leaf paths are: 阅读全文
posted @ 2017-12-05 13:29 逸朵 阅读(147) 评论(0) 推荐(0)
摘要:Given a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. Th 阅读全文
posted @ 2017-12-05 07:20 逸朵 阅读(142) 评论(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 @ 2017-12-05 05:25 逸朵 阅读(155) 评论(0) 推荐(0)
摘要:Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums except  阅读全文
posted @ 2017-12-05 01:44 逸朵 阅读(158) 评论(0) 推荐(0)
摘要:Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. According to the definition of LCA on Wikipedia: “The lowes 阅读全文
posted @ 2017-12-03 12:51 逸朵 阅读(147) 评论(0) 推荐(0)
摘要:Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST. According to the definition of LCA on Wikipedia 阅读全文
posted @ 2017-12-03 11:47 逸朵 阅读(157) 评论(0) 推荐(0)
摘要:Given an integer, write a function to determine if it is a power of two. 阅读全文
posted @ 2017-12-03 11:29 逸朵 阅读(102) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2017-12-03 09:44 逸朵 阅读(116) 评论(0) 推荐(0)
摘要:Given a sorted integer array without duplicates, return the summary of its ranges. Example 1: Example 2: 阅读全文
posted @ 2017-12-03 08:36 逸朵 阅读(137) 评论(0) 推荐(0)
摘要:Invert a binary tree. to 阅读全文
posted @ 2017-12-03 08:02 逸朵 阅读(112) 评论(0) 推荐(0)
摘要:Implement a basic calculator to evaluate a simple expression string. The expression string may contain open ( and closing parentheses ), the plus + or 阅读全文
posted @ 2017-12-03 07:50 逸朵 阅读(142) 评论(0) 推荐(0)
摘要:Find the total area covered by two rectilinear rectangles in a 2D plane. Each rectangle is defined by its bottom left corner and top right corner as s 阅读全文
posted @ 2017-12-03 07:18 逸朵 阅读(122) 评论(0) 推荐(0)
摘要:Given a complete binary tree, count the number of nodes. Definition of a complete binary tree from Wikipedia:In a complete binary tree every level, ex 阅读全文
posted @ 2017-12-03 03:10 逸朵 阅读(159) 评论(0) 推荐(0)
摘要:Given a 2D binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its area. For example, given the following ma 阅读全文
posted @ 2017-12-02 08:52 逸朵 阅读(143) 评论(0) 推荐(0)

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