归并排序 归并排序是我们最常使用的排序算法之一,作用是将两个或两个以上的有序数组合并成为一个新的数组,主要使用的是分治和递归的思想; 步骤 将数组分为等长的两部分,然后合并成一个新的数组,照这个思想对两半部分分别进行递归…
标签:LeetCode
[剑指offer] 顺时针打印矩阵
题目描述 输入一个矩阵,按照从外向里以顺时针的顺序依次打印出每一个数字,例如,如果输入如下矩阵: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 则依次打印出数字1,2,3,4,8,12,1…
二刷98. Validate Binary Search Tree
Medium Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as fo…
[LintCode][Trie] Add and Search Word
Problem Design a data structure that supports the following two operations: addWord(word) and search(word) sea…
Leetcode 68. Text Justification
Given an array of words and a length L, format the text such that each line has exactly L characters and is fu…
LeetCode刷题之Remove Duplicates from Sorted List II
Problem Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct number…
518. 零钱兑换 II 代码简洁版
简洁容易理解 class Solution(object): def change(self, amount, coins): """ :type amount: int :type coins: List[int] :…
LeetCode从零刷起 (3. Longest Substring Without Repeating Characters Add to List)
最近好久没有更新博客了,因为博主最近忙于学校的一些学业工作。大三下学期嘛,还是挺忙的-,-。 下面我们来看一下这道题: Given a string, find the length of the longest sub…
LeetCode算法题-Delete Node in a Linked List(Java实现)
这是悦乐书的第197次更新,第204篇原创 01 看题和准备 今天介绍的是LeetCode算法题中Easy级别的第60题(顺位题号是235)。编写一个函数来删除单链表中的节点(尾部除外),只允许访问该节点。例如: 鉴于链…
每日算法之LeetCode 483:Find All Anagrams in a String
LeetCode 483:Find All Anagrams in a String(找到字符串中所有字母异位词) Q:Given a string s and a non-empty string p, find al…
Day14.Judge Route Circle(657)
问题描述 Initially, there is a Robot at position (0, 0). Given a sequence of its moves, judge if this robot makes …
047 Permutations II[M]
1 题目描述 Given a collection of numbers that might contain duplicates, return all possible unique permutations. 难…