algorithms
sight23455
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
my raw answers for leetcode - 10. Regular Expression Matching
Given an input string (s) and a pattern (p), implement regular expression matching with support for '.' and '*'. '.' Matches any single character. '*' Matches zero or more of the preceding element. T...原创 2019-11-21 18:01:17 · 247 阅读 · 0 评论 -
An algorithm to calculate the greater 2^n close to num.
ifnum&(num-1)!=0{ fornum&(num-1)!=0{ num&=(num-1) } num=num<<1 }原创 2019-11-21 11:45:03 · 107 阅读 · 0 评论 -
my raw answers for leetcode - 9. Palindrome Number
Determine whether an integer is a palindrome. An integerisapalindrome when itreads the same backward as forward. Example 1: Input: 121 Output: true Example 2: Input: -121 Output: false Explanat...原创 2019-11-20 11:46:34 · 117 阅读 · 0 评论 -
my raw answers for leetcode - 8. String to Integer (atoi)
Implement atoi whichconverts 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 thi...原创 2019-11-19 18:25:15 · 107 阅读 · 0 评论 -
my raw answers for leetcode - 7. Reverse Integer
Given a 32-bit signed integer, reverse digits of an integer. Example 1: Input: 123 Output: 321 Example 2: Input: -123 Output: -321 Example 3: Input: 120 Output: 21 code: classSolution{ pub...原创 2019-11-13 18:24:03 · 151 阅读 · 0 评论 -
leetcode 11/10/19 周赛记录。
第一题: 1252. Cells with Odd Values in a Matrix Givennandmwhich are the dimensions of a matrix initialized by zeros and given an array indiceswhere indices[i] = [ri, ci]. For each pair of [ri, ci]...原创 2019-11-12 11:40:16 · 164 阅读 · 0 评论 -
my raw answers for leetcode - 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) And then read line by lin...原创 2019-11-08 15:08:42 · 140 阅读 · 0 评论 -
leetcode 11/02/19, 11/03/19 周赛记录。
第一次参加周赛就单双周一起报了。刷的题还不多,因此每场只记录2-3道自己掌握的(比赛时提交通过或完了通不过,事后看一眼就明白怎么回事的)。Cuz my current goal is to get completely control of questions which are easy or medium-hard to solve(The label "hard" marked by Lee...原创 2019-11-04 11:10:04 · 386 阅读 · 0 评论 -
my raw answers for leetcode - 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. Exampl...原创 2019-10-18 17:27:55 · 149 阅读 · 0 评论 -
my raw answers for leetcode - 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 n...原创 2019-10-17 16:46:19 · 138 阅读 · 0 评论 -
My first implementation of Cpp for Binary Search Tree.
After gettingthrough of some video lessons about such Binary Tree, Binary Search Tree, I get comprehend of this kind of algorithm method and would like to do a brief implementation. Following is my C...原创 2019-10-15 15:08:35 · 118 阅读 · 0 评论 -
my raw answers for leetcode - 3. Longest Substring Without Repeating Characters
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: In...原创 2019-10-12 11:58:37 · 116 阅读 · 0 评论 -
my raw answers for leetcode - 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 return i...原创 2019-10-10 11:32:52 · 138 阅读 · 0 评论 -
my raw answers for leetcode - 1. Two Sum
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 u...原创 2019-10-09 15:05:58 · 140 阅读 · 0 评论
分享