- 博客(15)
- 收藏
- 关注
原创 2020-08-24
C#版本主要特性要点:· C#2 泛型;· C#3 LINQ,Lambda表达式;· C#4 动态类型dynamic;· C#5 异步函数C#2 泛型如List,泛型主要解决了类型安全的问题,还可以避免产生额外的类型转换的代码。C#3LINQ全称 Language Integrated Query,语言集成查询。语法类似SQL,主要用于数据查询,不单单可用于数据库,也可用于查询XML。Lambda表达式大大简化了代码,增加代码可读性。例:x=>x*5;(x,y)
2020-08-24 15:52:15 80
原创 9. Palindrome Number
题目Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.Example 1:Input: 121Output: trueExample 2:Input: -121Output: falseExplana...
2020-03-15 18:18:49 67
原创 8. String to Integer (atoi)
题目Implement atoi which converts a string to an integer.The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from t...
2020-03-15 18:01:53 78
原创 7. Reverse Integer
题目Given a 32-bit signed integer, reverse digits of an integer.Example 1:Input: 123Output: 321Example 2:Input: -123Output: -321Example 3:Input: 120Output: 21Note:Assume we are dealing with ...
2020-03-15 17:11:38 80
原创 6. ZigZag Conversion
题目The string “PAYPALISHIRING” is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)P A H NA P L S I ...
2020-03-15 16:45:22 102
原创 5. Longest Palindromic Substring
题目Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.Example 1:Input: “babad”Output: “bab”Note: “aba” is also a valid answer.Examp...
2020-03-15 15:13:36 67
原创 4. Median of Two Sorted Arrays
题目There are two sorted arrays nums1 and nums2 of size m and n respectively.Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).You may assume nums1 and ...
2020-03-14 18:07:44 77
原创 3. Longest Substring Without Repeating Characters
题目Given a string, find the length of the longest substring without repeating characters.Example 1:Input: “abcabcbb”Output: 3Explanation: The answer is “abc”, with the length of 3.Example 2:Inpu...
2020-03-14 16:21:58 77
原创 2. Add Two Numbers
题目You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and retur...
2020-03-13 20:48:17 71
原创 1. Two Sum
题目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 exactly one solution, and you may not use the sam...
2020-03-13 20:08:58 65
原创 C++序列式容器(五):queue
queue,队列,是一种先进先出的数据结构,有两个出口。允许新增元素,移除元素,从最底端加入元素,取得最顶端元素,但除了底端加入,顶端取出外,没有任何其他方法可以存取queue的其他元素。不允许有遍历行为。默认是以deque作为底层容器,也可以使用list作为底层容器。因为list也是双向开口的数据结构,支持empty,size,back,push_front,push_back,pop_fro...
2020-03-13 15:03:22 107
原创 C++序列式容器(四):stack
stack是一种先进后出的数据结构,只有一个出口。允许新增元素,移除元素,取得最顶端元素,但除了最顶端外,没有任何其他方法可以存取stack的其他元素。不允许有遍历行为。默认是以deque作为底层容器,也可以使用list作为底层容器。因为list也是双向开口的数据结构,支持empty,size,back,push_back, pop_back等方法。...
2020-03-13 14:36:51 72
原创 C++序列式容器(三):deque
1. 概述deque是双向开口的连续线性空间,可以在头尾两端分别做插入和删除操作。主要维护了一块map(不是stl的map)作为主控。map是一小块连续空间,每个节点都指向另一段连续性空间,也称缓冲区。该缓冲区即是存储空间主体。当map满载,则会分配更大的空间作为map。其主要结构体如下: class deque{ public: typedef T value_type; typ...
2020-03-13 11:49:03 118
原创 c++序列式容器(二):list
1. 实现原理list由一个环状的双向链表构成,存有一个node指针,指向置于尾端的空白节点,从而满足stl“前闭后开”的规范。方法begin返回的是(*node).next,方法end返回的即是node自身。常用方法有:push_front, push_back 从前和后插入节点erase 移除节点pop_front, pop_back 移除头,尾节点clear 通过node遍历节点并...
2020-03-12 20:56:41 121
原创 c++序列式容器(一):Vector
1. 概述Vector维护的是一个连续的线性空间,有三个比较重要的指针,start指向目前使用空间的头,finish指向目前使用空间的尾,end_of_storage指向目前可用空间的尾。增加新元素的时候,如果备用空间不够,会将容量扩容到两倍。会经历“重新配置,元素移动,释放原空间”等过程,因此,扩容的时候效率会比较低,还需注意扩容后外部代码保存的iterator指针指向的还是旧的节点指针。2...
2020-03-12 16:47:47 133
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人