精进之路  

随笔分类 -  每日刷题

  • 调整数组为不降的序列
    摘要:题目 You are given an array of integers in an arbitrary order. Return whether or not it is possible to make the array non decreasing by modifying at mos 阅读全文
    posted @ 2019-10-13 23:39 Optimus_Prime 阅读(245) 评论(0) 推荐(0)
  • 找到数组中唯一不重复的元素
    摘要:题目 Given a list of numbers, where every number shows up twice except for one number, find that one number. Example: Input: [4, 3, 2, 4, 1, 3, 2] Outpu 阅读全文
    posted @ 2019-10-13 03:01 Optimus_Prime 阅读(803) 评论(0) 推荐(0)
  • Two Sum
    摘要:题目 You are given a list of numbers, and a target number k. Return whether or not there are two numbers in the list that add up to k. Example: Given [4 阅读全文
    posted @ 2019-10-12 00:54 Optimus_Prime 阅读(93) 评论(0) 推荐(0)
  • 排序一个仅有3个唯一数字元素组成的列表
    摘要:题目 Given a list of numbers with only 3 unique numbers (1, 2, 3), sort the list in O(n) time. Example 1: Input: [3, 3, 2, 1, 3, 2, 1] Output: [1, 1, 2, 阅读全文
    posted @ 2019-10-11 16:47 Optimus_Prime 阅读(165) 评论(0) 推荐(0)
  • 反转链表
    摘要:题目 Given a singly linked list, reverse the list. This can be done iteratively or recursively. Can you get both solutions? Example: Input: 4 3 2 1 0 NU 阅读全文
    posted @ 2019-10-10 01:30 Optimus_Prime 阅读(121) 评论(0) 推荐(0)
  • 数组元素查找
    摘要:题目 Given a sorted array, A, with possibly duplicated elements, find the indices of the first and last occurrences of a target element, x. Return 1 if 阅读全文
    posted @ 2019-10-09 01:18 Optimus_Prime 阅读(211) 评论(0) 推荐(0)
  • 括号匹配问题
    摘要:题目 Imagine you are building a compiler. Before running any code, the compiler must check that the parentheses in the program are balanced. Every openi 阅读全文
    posted @ 2019-10-08 02:40 Optimus_Prime 阅读(196) 评论(0) 推荐(0)
  • 最大回文子串
    摘要:题目 A palindrome is a sequence of characters that reads the same backwards and forwards. Given a string, s, find the longest palindromic substring in s 阅读全文
    posted @ 2019-10-08 02:34 Optimus_Prime 阅读(245) 评论(0) 推荐(0)
  • 找出不含重复字符的最长子串的长度
    摘要:题目 Given a string, find the length of the longest substring without repeating characters. 分析 任意2个重复的字符不可能同时存在于一个合法的子串中。因此,可以从左到右扫描字符,用一个字典记录出现过的字符。 一旦 阅读全文
    posted @ 2019-10-08 02:24 Optimus_Prime 阅读(408) 评论(0) 推荐(0)
  • 链表表示的2个数相加
    摘要:问题描述 You are given two linked lists representing two non negative integers. The digits are stored in reverse order and each of their nodes contain a s 阅读全文
    posted @ 2019-10-08 02:18 Optimus_Prime 阅读(192) 评论(0) 推荐(0)