• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
neverlandly
博客园    首页    新随笔    联系   管理    订阅  订阅

随笔分类 -  Lintcode

上一页 1 2 3 4 下一页
Lintcode: Flip Bits

摘要:Determine the number of bits required to flip if you want to convert integer n to integer m.Have you met this question in a real interview? YesExample... 阅读全文
posted @ 2016-01-06 04:34 neverlandly 阅读(501) 评论(0) 推荐(0)
Lintcode: Subarray Sum Closest

摘要:Given an integer array, find a subarray with sum closest to zero. Return the indexes of the first number and last number.Have you met this question in... 阅读全文
posted @ 2016-01-05 11:39 neverlandly 阅读(1417) 评论(0) 推荐(0)
Lintcode: Remove Node in Binary Search Tree

摘要:iven a root of Binary Search Tree with unique value for each node. Remove the node with given value. If there is no such a node with given value in t... 阅读全文
posted @ 2016-01-05 07:36 neverlandly 阅读(466) 评论(0) 推荐(0)
Lintcode: Majority Number III

摘要:Given an array of integers and a number k, the majority number is the number that occurs more than 1/k of the size of the array.Find it.Have you met t... 阅读全文
posted @ 2016-01-05 05:57 neverlandly 阅读(560) 评论(0) 推荐(0)
Lintcode: Singleton && Summary: Synchronization and OOD

摘要:Singleton is a most widely used design pattern. If a class has and only has one instance at every moment, we call this design as singleton. For exampl... 阅读全文
posted @ 2015-04-21 04:28 neverlandly 阅读(1827) 评论(0) 推荐(1)
Lintcode: Topological Sorting

摘要:这道题参考了网上一些很好的思路: method1: Record the pre nodes of every node, then find out a node without pre node in each iteration and delete this node from unvisi 阅读全文
posted @ 2015-04-16 12:29 neverlandly 阅读(1054) 评论(0) 推荐(0)
Lintcode: Rotate String

摘要:Given a string and an offset, rotate string by offset. (rotate from left to right)ExampleGiven "abcdefg"for offset=0, return "abcdefg"for offset=1, re... 阅读全文
posted @ 2015-04-15 05:44 neverlandly 阅读(1458) 评论(0) 推荐(0)
Lintcode: Two Strings Are Anagrams

摘要:Write a method anagram(s,t) to decide if two strings are anagrams or not.ExampleGiven s="abcd", t="dcab", return trueO(N)time, O(1) space 1 public cla... 阅读全文
posted @ 2015-04-15 04:08 neverlandly 阅读(950) 评论(0) 推荐(0)
Lintcode: Subarray Sum

摘要:Given an integer array, find a subarray where the sum of numbers is zero. Your code should return the index of the first number and the index of the l... 阅读全文
posted @ 2015-04-06 12:48 neverlandly 阅读(639) 评论(1) 推荐(0)
Lintcode: Sort Letters by Case

摘要:Given a string which contains only letters. Sort it by lower case first and upper case second.NoteIt's not necessary to keep the original order of low... 阅读全文
posted @ 2015-04-06 09:31 neverlandly 阅读(1086) 评论(0) 推荐(0)
Lintcode: Sort Colors II

摘要:Given an array of n objects with k different colors (numbered from 1 to k), sort them so that objects of the same color are adjacent, with the colors ... 阅读全文
posted @ 2015-04-06 09:11 neverlandly 阅读(705) 评论(0) 推荐(0)
Lintcode: Single Number III

摘要:Given 2*n + 2 numbers, every numbers occurs twice except two, find them.ExampleGiven [1,2,2,3,4,4,5,3] return 1 and 5ChallengeO(n) time, O(1) extra sp... 阅读全文
posted @ 2015-04-04 04:59 neverlandly 阅读(2520) 评论(0) 推荐(0)
Lintcode: Search Range in Binary Search Tree

摘要:Given two values k1 and k2 (where k1 k1, 如果否,则不需要继续向左递归;右子树的处理方法类似第一次做法,把result数组作为return type,不好,消耗额外空间 1 public class Solution { 2 /** 3 *... 阅读全文
posted @ 2015-04-04 03:39 neverlandly 阅读(1229) 评论(0) 推荐(0)
Lintcode: Binary Tree Serialization (Serialization and Deserialization Of Binary Tree)

摘要:Design an algorithm and write code to serialize and deserialize a binary tree. Writing the tree to a file is called 'serialization' and reading back f... 阅读全文
posted @ 2015-04-04 02:59 neverlandly 阅读(1005) 评论(0) 推荐(0)
Lintcode: Search a 2D matrix II

摘要:Write an efficient algorithm that searches for a value in an m x n matrix, return the occurrence of it.This matrix has the following properties: * ... 阅读全文
posted @ 2015-04-02 12:26 neverlandly 阅读(2221) 评论(0) 推荐(0)
Lintcode: Rehashing

摘要:The size of the hash table is not determinate at the very beginning. If the total size of keys is too large (e.g. size >= capacity / 10), we should do... 阅读全文
posted @ 2015-04-02 11:13 neverlandly 阅读(850) 评论(0) 推荐(0)
Lintcode: Recover Rotated Sorted Array

摘要:Given a rotated sorted array, recover it to sorted array in-place.Example[4, 5, 1, 2, 3] -> [1, 2, 3, 4, 5]ChallengeIn-place, O(1) extra space and O(n... 阅读全文
posted @ 2015-04-02 10:33 neverlandly 阅读(1366) 评论(0) 推荐(0)
Lintcode: Product of Array Exclude Itself

摘要:Given an integers array A.Define B[i] = A[0] * ... * A[i-1] * A[i+1] * ... * A[n-1], calculate B without divide operation.ExampleFor A=[1, 2, 3], B is... 阅读全文
posted @ 2015-04-02 09:59 neverlandly 阅读(1931) 评论(0) 推荐(0)
Lintcode: Previous Permuation

摘要:Given a list of integers, which denote a permutation.Find the previous permutation in ascending order.NoteThe list may contains duplicate integers.Exa... 阅读全文
posted @ 2015-04-02 07:01 neverlandly 阅读(1212) 评论(0) 推荐(0)
Lintcode: Partition Array

摘要:Given an array "nums" of integers and an int "k", Partition the array (i.e move the elements in "nums") such that, * All elements = k are moved to ... 阅读全文
posted @ 2015-04-02 06:21 neverlandly 阅读(1702) 评论(0) 推荐(0)

上一页 1 2 3 4 下一页
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3