![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
涮題
Sumerking
这个作者很懒,什么都没留下…
展开
-
抽奖demo
【代码】抽奖demo。原创 2022-08-24 14:16:51 · 208 阅读 · 1 评论 -
LeetCode 7th day
27.移除元素class Solution: def removeElement(self, nums: List[int], val: int) -> int: for data in nums: if data == val: nums.remove(data) self.removeElement(nums,val) return len(nums)int re原创 2021-01-06 16:18:52 · 87 阅读 · 0 评论 -
Leetcode sixth day
有效的括號 class Solution {public: bool isValid(string s) { unordered_map<char,int> m{{'(',1},{'[',2},{'{',3},{')',4},{']',5},{'}',6}}; stack <char> st; bool isTrue =true; for(char c:s) {原创 2020-12-16 17:05:39 · 104 阅读 · 0 评论 -
Leetcode fifth day
class Solution: def longestCommonPrefix(self, strs: List[str]) -> str: if not strs: return "" str0 = min(strs) str1 = max(strs) for i in range(len(str0)): if str0[i] != str1[i]:原创 2020-12-15 17:21:18 · 92 阅读 · 0 评论 -
Leetcode fouth day
羅馬數轉換數字 class Solution: def romanToInt(self, s: str) -> int: dic = {'I' : 1, 'V' : 5, 'X' : 10, 'L' : 50, 'C' : 100, 'D' : 500, 'M' : 1000} alist = ['IV', 'IX', 'XL', 'XC', 'CD', 'CM'] s += ' ' ans = 0 i = 0原创 2020-12-04 17:28:47 · 97 阅读 · 0 评论 -
Leetcode third day
回文數bool isPalindrome(int x){ if(x<0) return false; long y=0; int z=x; while(z!=0) { y=y*10+z%10; z/=10; } if(y==x) return true; return false;}原创 2020-12-03 16:55:32 · 79 阅读 · 0 评论 -
Leetcode second day
int reverse(int x){ //int x; int ttr; long long int rev=0; unsigned long long int a; //scanf("%d",&x); if(x>=0) { while(x/10!=0)11111 { ttr=x%10; x=x/10; rev=rev*10+ttr; } .原创 2020-12-02 19:33:54 · 70 阅读 · 0 评论 -
LeetCode first day
第一天利用GitHub賬號登陸LeetCode開始刷題.求兩數之和1.pythonclass Solution: def twoSum(self,nums,target): m = len(nums) for x in range(n): a = target - nums[x] if a in nums: y = nums.index(a) if x == y: continue else: return x,y原创 2020-12-01 16:50:29 · 97 阅读 · 0 评论