摘要:
[抄题]: Given a linked list, swap every two adjacent nodes and return its head. Example: Note: Your algorithm should use only constant extra space. You 阅读全文
posted @ 2018-07-31 18:38
苗妙苗
阅读(211)
评论(0)
推荐(0)
摘要:
[抄题]: Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. Example 1: Example 2: [暴力解法]: 时间分析: 空间分 阅读全文
posted @ 2018-07-31 17:25
苗妙苗
阅读(140)
评论(0)
推荐(0)
摘要:
[抄题]: Given an 2D board, count how many battleships are in it. The battleships are represented with 'X's, empty slots are represented with '.'s. You m 阅读全文
posted @ 2018-07-31 16:38
苗妙苗
阅读(131)
评论(0)
推荐(0)
摘要:
[抄题]: [暴力解法]: 时间分析: 空间分析: [优化后]: 时间分析: 空间分析: [奇葩输出条件]: [奇葩corner case]: [思维问题]: 总算自己写出一道题来了。 [英文数据结构或算法,为什么不用别的数据结构或算法]: [一句话思路]: 总有case过不了,可以稍微调试一下,起 阅读全文
posted @ 2018-07-31 16:19
苗妙苗
阅读(120)
评论(0)
推荐(0)
摘要:
[抄题]: Given an input string, reverse the string word by word. Example: [暴力解法]: 时间分析: 空间分析: [优化后]: 时间分析: 空间分析: [奇葩输出条件]: [奇葩corner case]: [思维问题]: 打碎成数组 阅读全文
posted @ 2018-07-31 14:52
苗妙苗
阅读(302)
评论(0)
推荐(0)
摘要:
[抄题]: Given an array of integers, find out whether there are two distinct indices i and j in the array such that the absolute difference between nums[ 阅读全文
posted @ 2018-07-31 10:06
苗妙苗
阅读(188)
评论(0)
推荐(0)