mysql -uroot //登录数据库 mysql.exe -h127.0.0.1 -p3306 -uroot -p mysql -uroot<拖拽脚本 // insert into 表名 values(.....); delete from 表名 where 列名=值; update 表名 set 列名=修改的值,....where 列名=值; select * from 表名;
let a: string = 'hello'; let b: number = 1234; let c: boolean = true; let d: undefined = undefined; let e: symbol = Symbol('world'); let f: bigint = 1234567123456123n; let g: null = null; // null也可以作为一个基本类型使用
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 return it as a linked list.
You may assume the two numbers do not contain any leading zero, except the number 0 itself.
Given a string, find the length of the longest substring without repeating characters.
Example 1:
Input: "abcabcbb" Output: 3 Explanation: The answer is "abc", with the length of 3. Example 2:
Input: "bbbbb" Output: 1 Explanation: The answer is "b", with the length of 1. Example 3:
Input: "pwwkew" Output: 3 Explanation: The answer is "wke", with the length of 3. Note that the answer must be a substring, "pwke" is a subsequence and not a substring.
解题方案
思路 1 **- 时间复杂度: O(N^2)**- 空间复杂度: O(N)**
暴力解法
代码:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
/** * @param {string}s * @return {number} */ let lengthOfLongestSubstring = function (s) { let result = 0; for (let i = 0, len = s.length; i < len; i++) { let set = newSet(); set.add(s.charAt(i)); for (let j = i + 1; j < len; j++) { if (set.has(s.charAt(j))) { break; } set.add(s.charAt(j)); } result = Math.max(result,set.size); } return result; };