随笔分类 - a) Leetcode
摘要:最近遇到的几个有意思问题,记录分享一下。 1. 合并三个有序数组(合并K个有序数组) 假如有这么三个数组:(arr包含的三个数组) 问题:K个数组,总共N个元素,合并成一个有序数组。(以升序为例) 大家一眼看上去肯定会想到归并排序,合并两个有序数组是归并排序的最后一步的动作,通过两个指针引导比较大小
阅读全文
摘要:Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the s
阅读全文
摘要: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
阅读全文
摘要:简单题,判断好每种情况,(原来剑指offer这个oj需要把js的函数写在给的solution函数里才能AC啊) 传说中的毒瘤题,曾经的一个大佬去google面试时现场没写出来,被google说滚蛋。。。 其实很简单,老样子树结构判断好null 之前就遇到别人讨论过这题,今天碰到这题也格外的亲切,一种
阅读全文
摘要:Given an array of strings, group anagrams together. For example, given: ["eat", "tea", "tan", "ate", "nat", "bat"], Return: Note: All inputs will be i
阅读全文
摘要:14. Longest Common Prefix 14. Longest Common Prefix 14. Longest Common Prefix 14. Longest Common Prefix DescriptionHintsSubmissionsDiscussSolution Des
阅读全文
摘要:题目: Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring. For "(()", th
阅读全文
摘要:Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such arrangement is not possib
阅读全文
摘要:Given a linked list, remove the nth node from the end of list and return its head. For example, Note:Given n will always be valid.Try to do this in on
阅读全文
摘要:Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpo
阅读全文
摘要:6. ZigZag Conversion 6. ZigZag Conversion 6. ZigZag Conversion 6. ZigZag Conversion DescriptionHintsSubmissionsDiscussSolution DescriptionHintsSubmiss
阅读全文
摘要:5. Longest Palindromic Substring DescriptionHintsSubmissionsDiscussSolution DiscussPick One Given a string s, find the longest palindromic substring i
阅读全文
摘要:3. Longest Substring Without Repeating Characters 3. Longest Substring Without Repeating Characters 3. Longest Substring Without Repeating Characters
阅读全文
摘要:2. Add Two Numbers 2. Add Two Numbers 2. Add Two Numbers 2. Add Two Numbers DescriptionHintsSubmissionsDiscussSolution DescriptionHintsSubmissionsDisc
阅读全文
摘要:260. Single Number III 260. Single Number III 260. Single Number III 260. Single Number III DescriptionHintsSubmissionsDiscussSolution DescriptionHint
阅读全文
摘要:137. Single Number II DescriptionHintsSubmissionsDiscussSolution DiscussPick One Given an array of integers, every element appears three times except
阅读全文
摘要:以前tao哥就讲过,想不到在Leetcode里面分类是一个Easy的问题。 另外Leetcode上只需要一个返回值,不需要main函数,跟平时刷的Oj系统还是不同的
阅读全文