自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(18)
  • 收藏
  • 关注

原创 2021-01-23

public class LRUCache{ private readonly int _length; private readonly List<KeyValuePair<int, int>> _lst; public LRUCache(int capacity) { _length = capacity; _lst = new List<KeyValuePair<int, int>>(.

2021-01-23 20:35:13 61 2

原创 2021-01-21

public class Solution{ public int MaxProfit(int[] prices) { if (prices.Length <= 1) return 0; int min = prices[0]; int max = 0; for (int i = 1; i < prices.Length; i++) { if (p.

2021-01-21 21:09:46 58

原创 2021-01-20

public class Solution{ public void Merge(int[] nums1, int m, int[] nums2, int n) { int j = 0; for (int i = 0; i < n; i++) { int num2 = nums2[i]; while (num2 > nums1[j] && j < m) .

2021-01-20 09:13:16 56

原创 2021-01-19

public class Solution{ private int _m; private int _n; public int UniquePaths(int m, int n) { _m = m; _n = n; int count = 0; RecordPaths(0, 0, ref count); return count; } private void Record.

2021-01-19 11:36:47 55

原创 2021-01-18

public class Solution{ public IList<int> SpiralOrder(int[][] matrix) { IList<int> result = new List<int>(); if (matrix == null || matrix.Length == 0) return result; int start = 0; ...

2021-01-18 09:19:53 41

原创 2021-01-17

public class Solution { public string Multiply(string num1, string num2) { if (num1 == "0" || num2 == "0") return "0"; int len1 = num1.Length; int len2 = num2.Length; int len = len1 + len2; int[] tem.

2021-01-17 10:32:53 44

原创 2021-01-16

public class Solution { public int Search(int[] nums, int target) { int i = 0, j = nums.Length - 1; while (i <= j) { int mid = (i + j) / 2; if (nums[mid] == target) return mid;.

2021-01-16 22:32:47 42

原创 2021-01-15

/** * Definition for singly-linked list. * public class ListNode { * public int val; * public ListNode next; * public ListNode(int x) { val = x; } * } */public class Solution{ public ListNode MergeTwoLists(ListNode l1, ListNode l2.

2021-01-15 16:16:35 53

原创 2021-01-11

public class Solution{public ListNode AddTwoNumbers(ListNode l1, ListNode l2){ListNode result = new ListNode(-1);ListNode l3 = result;int flag = 0;while (l1 != null && l2 != null){int a = l1.val;int b = l2.val;int c = a + b + flag;l3.ne

2021-01-11 20:58:28 35

原创 2020-08-09

f = open(‘test.txt’, ‘w+’)seq = [‘小马的程序人生\n’, ‘老马的程序人生’]f.writelines(seq)f.seek(0, 0)for each in f:print(each)小马的程序人生老马的程序人生f.close()try:f = open(‘myfile.txt’, ‘w’)for line in f:print(line)except OSError as error:print(‘出错啦!%s’ % str(error))

2020-08-09 20:15:40 107

原创 2020-08-07

import datetimedt = datetime.datetime(year=2020, month=6, day=25, hour=11, minute=51, second=49)print(dt.date()) # 2020-06-25print(type(dt.date())) # <class ‘datetime.date’>print(dt.time()) # 11:51:49print(type(dt.time())) # <class ‘datet

2020-08-07 12:04:42 88

原创 2020-08-05

class Animal:def run(self):raise AttributeError(‘子类必须实现这个方法’)class People(Animal):def run(self):print(‘人正在走’)class Pig(Animal):def run(self):print(‘pig is walking’)class Dog(Animal):def run(self):print(‘dog is running’)def func(animal):animal.

2020-08-05 07:24:44 109

原创 python6

def printme(str):print(str)printme(“我要调用用户自定义函数!”) # 我要调用用户自定义函数!printme(“再次调用同一函数”) # 再次调用同一函数temp = printme(‘hello’) # helloprint(temp) # Nonedef printinfo(arg1, *args):print(arg1)for var in args:print(var)printinfo(10) # 10printinfo(70, 6

2020-08-02 22:32:09 59

原创 python5

print(isinstance(1, int)) # Trueprint(isinstance(5.2, float)) # Trueprint(isinstance(True, bool)) # Trueprint(isinstance(‘5.2’, str)) # Trueprint(int(‘520’)) # 520print(int(520.52)) # 520print(float(‘520.52’)) # 520.52print(float(520)) # 520

2020-07-31 22:45:46 149

原创 python4

count = 0while count < 5:print("%d is less than 5" % count)count = 6breakelse:print("%d is not less than 5" % count)import randomsecret = random.randint(1, 10) #[1,10]之间的随机数while True:temp = input(“猜一个数”)guess = int(temp)if guess > secre

2020-07-28 23:20:10 60

原创 python3

dict1 = {‘a’: 1, ‘b’: 2, ‘v’: 22}try:x = dict1[‘y’]except LookupError:print(‘查询错误’)except KeyError:print(‘键错误’)else:print(x)查询错误dict1 = {'a': 1, 'b': 2, 'v': 22}try: x = dict1['y']except KeyError: print('键错误')except LookupError: pr

2020-07-25 12:03:10 43

原创 python2

temp = input(‘请输入成绩:’)source = int(temp)if 100 >= source >= 90:print(‘A’)elif 90 > source >= 80:print(‘B’)elif 80 > source >= 60:print(‘C’)elif 60 > source >= 0:print(‘D’)else:print(‘输入错误!’)...

2020-07-23 23:50:37 55

原创 python

print(-3 ** 2) # -9print(3 ** -2) # 0.1111111111111111print(1 << 3 + 2 & 7) # 0print(-3 * 2 + 5 / -2 - 4) # -12.5print(3 < 4 and 4 < 5) # True00 00 01 01 -> 5~---11 11 10 10 -> -611 11 10 11 -> -5~---00 00 01 00 -

2020-07-22 19:27:41 101

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除