mrlonelyjtr's blog

写BUG的程序猿


  • Home

  • Categories

  • Archives

  • Tags

  • Search

[LeetCode] Problem 8 - String to Integer (atoi)

Posted on 2017-09-11 | In Algorithm , LeetCode
Implement atoi to convert a string to an integer. The function first discards as many whitespace characters as necessary until the first non-whitespac ...
Read more »

[LeetCode] Problem 28 - Implement strStr()

Posted on 2017-09-11 | In Algorithm , LeetCode
Implement strStr(). Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. ExampleNo.1Input: haysta ...
Read more »

[LeetCode] Problem 125 - Valid Palindrome

Posted on 2017-09-11 | In Algorithm , LeetCode
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. NoteFor the purpose of this problem, we ...
Read more »

[LeetCode] Problem 167 - Two Sum II - Input array is sorted

Posted on 2017-09-11 | In Algorithm , LeetCode
Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number. The function ...
Read more »

[LeetCode] Problem 1 - Two Sum

Posted on 2017-09-10 | In Algorithm , LeetCode
Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have ex ...
Read more »

【剑指Offer】机器人的运动范围

Posted on 2017-09-10 | In Algorithm , 剑指Offer
题目地上有一个m行n列的方格。一个机器人从坐标(0,0)的格子开始移动,它每一次可以向左、右、上、下移动一格,但不能进入行坐标和列坐标的数位之和大于k的格子。例如,当k为18时,机器人能够进入方格(35,37),因为3+5+3+7=18。但它不能进入方格(35,38)。因为3+5+3+8=19.请问 ...
Read more »

【剑指Offer】矩阵中的路径

Posted on 2017-09-09 | In Algorithm , 剑指Offer
题目请设计一个函数,用来判断在一个矩阵中是否存在一条包含某字符串所有字符的路径。路径可以从矩阵中任意一格开始,每一步可以在矩阵中向左、右、上、下移动一格。如果一条路径经过了矩阵的某一格,那么该路径不能再次进入该格子。例如在下面的3x4的矩阵中包含一条字符串“bcced”的路径。但矩阵中不包含字符串“ ...
Read more »

【剑指Offer】滑动窗口的最大值

Posted on 2017-09-08 | In Algorithm , 剑指Offer
题目给定一个数组和滑动窗口的大小,请找出所有滑动窗口里的最大值。例如,如果输入数组{2, 3, 4, 2, 6, 2, 5, 1}及滑动窗口的大小3,那么一共存在6个滑动窗口,它们的最大值分别为{4, 4, 6, 6, 6, 5}。 实现1234567891011121314151617181920 ...
Read more »

【剑指Offer】数据流中的中位数

Posted on 2017-09-08 | In Algorithm , 剑指Offer
题目如何得到一个数据流中的中位数?如果从数据流中读出奇数个数值,那么中位数就是所有数值排序之后位于中间的数值。如果从数据流中读出偶数个数值,那么中位数就是所有数值排序后中间两个数的平均值。 实现123456789101112131415161718192021222324252627private ...
Read more »

【剑指Offer】二叉搜索树的第k个结点

Posted on 2017-09-08 | In Algorithm , 剑指Offer
题目给定一棵二叉搜索树,请找出其中的第k大的结点。 实现123456789public class TreeNode { int val = 0; TreeNode left = null; TreeNode right = null; public Tre ...
Read more »
1…707172…78
mrlonelyjtr

mrlonelyjtr

间歇性踌躇满志,持续性混吃等死

780 posts
18 categories
18 tags
Github
© 2020 mrlonelyjtr
Powered by Hexo
Theme - NexT.Pisces