数据结构和算法
文章平均质量分 55
数据结构和算法
丹辰子DCZ
学习使人兴奋,装逼让人快乐。
展开
-
leetcode-day18:3Sum(三数之和)
3sum 三数之和原创 2021-12-06 23:38:47 · 627 阅读 · 0 评论 -
leetcode-day17:Two Sum(两数之和)
Two sum 两数之和原创 2021-12-03 09:17:57 · 583 阅读 · 0 评论 -
leetcode-day16:Happy Number(快乐数)
快乐数原创 2021-12-02 14:08:01 · 481 阅读 · 0 评论 -
leetcode-day15:Intersection of Two Arrays(两个数组的交集)
两个数组的交集原创 2021-12-01 09:32:37 · 378 阅读 · 0 评论 -
leetcode-day14:Find Common Characters(查找共用字符)
1002. Find Common CharactersGiven a string array words, return an array of all characters that show up in all strings within the words (including duplicates). You may return the answer in any order.Example 1:Input: words = ["bella","label","roller"]Out原创 2021-11-30 15:39:18 · 232 阅读 · 0 评论 -
leetcode-day13:Valid Anagram(有效的字母异位词)
242. Valid Anagram哈希表:可以拿数组当哈希表来用,但哈希值不要太大Given two strings s and t, return true if t is an anagram of s, and false otherwise.Example 1:Input: s = "anagram", t = "nagaram"Output: trueExample 2:Input: s = "rat", t = "car"Output: falseConstraints:原创 2021-11-29 15:01:01 · 318 阅读 · 0 评论 -
leetcode-day12:Linked List Cycle II(环形链表II)
142. Linked List Cycle II链表:环找到了,那入口呢?Given the head of a linked list, return the node where the cycle begins. If there is no cycle, return null.There is a cycle in a linked list if there is some node in the list that can be reached again by continuousl原创 2021-11-26 16:33:57 · 540 阅读 · 0 评论 -
leetcode-day11:Intersection of Two Linked Lists(链表相交)
160. Intersection of Two Linked Lists链表:链表相交Given the heads of two singly linked-lists headA and headB, return the node at which the two lists intersect. If the two linked lists have no intersection at all, return null.For example, the following two lin原创 2021-11-25 15:36:54 · 520 阅读 · 0 评论 -
leetcode-day10:Remove Nth Node From End of List(删除链表的倒数第N个节点)
19. Remove Nth Node From End of List链表:删除链表的倒数第 N 个结点Given the head of a linked list, remove the nth node from the end of the list and return its head.Example 1:Input: head = [1,2,3,4,5], n = 2Output: [1,2,3,5]Example 2:Input: head = [1], n = 1Ou原创 2021-11-24 14:50:24 · 422 阅读 · 0 评论 -
leetcode-day9:Swap Nodes in Pairs(两两交换链表中的节点)
24. Swap Nodes in Pairs链表:两两交换链表中的节点Given a linked list, swap every two adjacent nodes and return its head. You must solve the problem without modifying the values in the list’s nodes (i.e., only nodes themselves may be changed.)Example 1:Input: head原创 2021-11-23 16:05:07 · 516 阅读 · 0 评论 -
leetcode-day8:Reverse Linked List(反转链表)
206. Reverse Linked ListGiven the head of a singly linked list, reverse the list, and return the reversed list.Example 1:Input: head = [1,2,3,4,5]Output: [5,4,3,2,1]Example 2:Input: head = [1,2]Output: [2,1]Example 3:Input: head = []Output: [原创 2021-11-23 10:49:33 · 535 阅读 · 0 评论 -
leetcode-day7:Design Linked List(设计链表)
707. Design Linked List链表:一道题目考察了常见的五个操作!Design your implementation of the linked list. You can choose to use a singly or doubly linked list.A node in a singly linked list should have two attributes: val and next. val is the value of the current node, a原创 2021-11-22 17:19:40 · 116 阅读 · 0 评论 -
leetcode-day6:Remove Linked List Elements(移除链表元素)
203. Remove Linked List Elements链表:听说用虚拟头节点会方便很多?Given the head of a linked list and an integer val, remove all the nodes of the linked list that has Node.val == val, and return the new head.Example 1:Input: head = [1,2,6,3,4,5,6], val = 6Output: [1,原创 2021-11-19 10:25:10 · 488 阅读 · 0 评论 -
leetcode-day5:Spiral Matrix II(螺旋矩阵II)
59. Spiral Matrix II数组:这个循环可以转懵很多人!Given a positive integer n, generate an n x n matrix filled with elements from 1 to n2 in spiral order.Example 1:Input: n = 3Output: [[1,2,3],[8,9,4],[7,6,5]]Example 2:Input: n = 1Output: [[1]]Constraints:1 &原创 2021-11-18 10:47:25 · 312 阅读 · 0 评论 -
leetcode-day4:Minimum Size Subarray Sum(长度最小的子数组)
209. Minimum Size Subarray Sum数组:滑动窗口拯救了你Given an array of positive integers nums and a positive integer target, return the minimal length of a contiguous subarray [numsl, numsl+1, …, numsr-1, numsr] of which the sum is greater than or equal to target. I原创 2021-11-17 10:31:00 · 570 阅读 · 0 评论 -
leetcode 百题大战
leetcode每天一题原创 2021-11-16 16:06:54 · 588 阅读 · 0 评论 -
leetcode-day3:Squares of a Sorted Array(有序数组的平方)
数组:有序数组的平方,还有序么?977. Squares of a Sorted ArrayLeetCode题目链接Given an integer array nums sorted in non-decreasing order, return an array of the squares of each number sorted in non-decreasing order.Example 1:Input: nums = [-4,-1,0,3,10]Output: [0,1,9,16原创 2021-11-16 10:10:23 · 973 阅读 · 0 评论 -
leetcode-day2:remove-element(移除元素)
27. Remove ElementLeetCode题目链接Given an integer array nums and an integer val, remove all occurrences of val in nums in-place. The relative order of the elements may be changed.Since it is impossible to change the length of the array in some languages, y原创 2021-11-16 09:20:45 · 346 阅读 · 1 评论 -
leetcode-day1:binary-search(二分查找)
Binary Searchleetcode题目链接 [link](https://leetcode.com/problems/binary-search/).Given an array of integers nums which is sorted in ascending order, and an integer target, write a function to search target in nums. If target exists, then return its ind.原创 2021-11-16 09:10:34 · 268 阅读 · 0 评论 -
关于堆栈的讲解(我见过的最经典的)
这是一篇转发的文章,我对他进行了格式化而已,原文出处不详。一、预备知识—程序的内存分配一个由c/C++编译的程序占用的内存分为以下几个部分 1、栈区(stack)— 由编译器自动分配释放 ,存放函数的参数值,局部变量的值等。其操作方式类似于数据结构中的栈。 2、堆区(heap) — 一般由程序员...转载 2018-12-24 20:11:33 · 1128 阅读 · 0 评论 -
红黑树,B数,B+树实战应用原理
转发自头条号:Java全栈技术作者:channingbreeze 互联网侦察小史是一个应届生,虽然学的是电子专业,但是自己业余时间看了很多互联网与编程方面的书,一心想进BAT互联网公司。话说两个多月前,小史通过了A厂的一面,两个多月后的今天,小史终于等到了A厂的二面。简单的自我介绍后,面试官看了看小史的简历,开始发问了。【面试现场】小史:没问题,这个项目前端用的react+webpack,后端用的...转载 2018-12-12 10:44:46 · 865 阅读 · 3 评论