- 博客(25)
- 收藏
- 关注
原创 【Computer Systems】写编译器compiler的第一步
位于此编译器模型核心的中间代码 intermediate code 旨在运行在称为虚拟机或 VM 的抽象计算机上。如何将VM code翻译成汇编语言是一个经典问题。
2021-11-26 13:24:48 568
原创 【Computer Systems】Assembler 如何写一个汇编器
汇编器(Assembler)是将汇编语言翻译为机器语言的程序。将要学习如何写一个汇编器。
2021-11-26 06:17:08 1325
原创 【Big Java学习笔记】Chapter 9:Inheritance and Interfaces 继承和接口2
Inheritance and Interfaces 继承和接口知识点2
2021-11-22 09:21:36 128
原创 【Big Java学习笔记】Chapter 9:Inheritance and Interfaces 继承和接口
Chapter 9:Inheritance and Interface1)学习继承并实现子类override方法2)理解多态polymorphism的概念3)熟悉common superclass Object 和它的 methods4)学习interface types
2021-11-22 02:40:23 148
原创 【Git】从零开始学习Git 1:简介和创建账户
发现自己其实现在也不太懂git,刚好学校给我的canvas里加了这个bootcamp让同学们自学,所以学习一下自己做个笔记。也希望这篇笔记对和我一样情况的同学有所帮助。
2021-11-19 02:28:45 894
原创 [LeetCode]Medium - Cutting Ribbons - python
在csdn上发现这道题只有java或者cpp的解答,补个python版本的解法吧。思路:就是二分法,之后空一点了再写。class Solution: def maxLength(self, ribbons: List[int], k: int) -> int: def possible(size): num_rib = 0 for rib in ribbons: num_rib +=
2021-11-13 03:19:10 963
原创 [LeetCode]easy - Climbing Stairs - python
题目要求:给定一个整数n,是台阶的级数。每次只能向上一级台阶或者两级台阶,求有几种不同的方式可以爬完n级台阶。Problem Description:You are climbing a staircase. It takesnsteps to reach the top.Each time you can either climb1or2steps. In how many distinct ways can you climb to the top?题目链接...
2021-10-02 02:25:15 93
原创 [LeetCode]easy - Sqrt(x) - python
题目要求:求一个非负数的平方根,精确到整数位。Problem Description:Given a non-negative integerx,compute and returnthe square root ofx.Since the return typeis an integer, the decimal digits aretruncated, and onlythe integer partof the resultis returned.Note:...
2021-10-02 02:16:50 107
原创 [LeetCode]easy - Add Binary - python
题目要求:求两个二进制数的和,返回值也是二进制形式的。Problem Description:Given two binary stringsaandb, returntheir sum as a binary string.题目链接思路一:直接利用python自带函数 int() 将二进制数转化为十进制数进行相加,然后将和转化为二进制数返回,此处取 [2:]是因为要去掉开头的0b标识符。这样的处理速度真的很快。class Solution(object): ...
2021-10-02 02:08:32 60
原创 [LeetCode]easy - Plus One - python
题目要求:给定一个非常大的整数,返回它加一后的结果。Problem Description:You are given alarge integerrepresented as an integer arraydigits, where eachdigits[i]is theithdigit of the integer. The digits are ordered from most significant to least significant in left-to-r...
2021-10-02 01:59:28 113
原创 [LeetCode]easy - Length of Last Word - python
题目要求:输入一个由一些单词与空格组成的字符串,输出其最后一个单词的长度。Problem Description:Given a stringsconsistingof some words separated by some number of spaces, returnthe length of thelastword in the string.Awordis a maximal substring consisting of non-space characters...
2021-10-02 01:49:30 67
原创 [LeetCode]easy - Maximum Subarray - python
Problem Description:题目链接class Solution(object): def maxSubArray(self, nums): """ :type nums: List[int] :rtype: int """ max_sum = nums[0] for i in range(0,len(nums)): current_sum = num
2021-09-30 02:16:30 155
原创 [LeetCode]easy - Search Insert Position - python
Problem Description:题目链接class Solution(object): def searchInsert(self, nums, target): """ :type nums: List[int] :type target: int :rtype: int """ length = len(nums) left = 0 right =
2021-09-28 05:26:57 115
原创 [LeetCode]easy - Implement strStr() - python
Problem Description:题目链接class Solution(object): def strStr(self, haystack, needle): """ :type haystack: str :type needle: str :rtype: int """ if needle == '': return 0 else:
2021-09-28 05:13:02 107
原创 [LeetCode]easy - Remove Element - python
Problem Description:Given an integer arraynumsand an integerval, remove all occurrences ofvalinnumsin-place. The relative order of the elements may be changed.Since it is impossible to change the length of the array in some languages, you must...
2021-09-27 22:11:21 181
原创 [LeetCode]easy - Remove Duplicates from Sorted Array - python
Problem Description:Given an integer arraynumssorted innon-decreasing order, remove the duplicatesin-placesuch that each unique element appears onlyonce. Therelative orderof the elements should be kept thesame.Since it is impossible to chang...
2021-09-27 22:02:35 105
原创 [LeetCode]easy - Merge Two Sorted Lists - python
Problem Description:Merge two sorted linked lists and return it as asortedlist. The list should be made by splicing together the nodes of the first two lists.题目链接题目要求# Definition for singly-linked list.# class ListNode(object):# def __init..
2021-09-27 02:17:22 87
原创 [LeetCode]easy - Valid Parentheses - python
Problem Description:Given a stringscontaining just the characters'(',')','{','}','['and']', determine if the input string is valid.An input string is valid if:Open brackets must be closed by the same type of brackets. Open brackets must b...
2021-09-25 23:09:14 82
原创 [LeetCode]easy - Longest Common Prefix - python
Problem Description:Write a function to find the longest common prefix string amongst an array of strings.If there is no common prefix, return an empty string"".题目链接题目要求思路一:class Solution(object): def longestCommonPrefix(self, strs):.
2021-09-25 22:35:24 86
原创 [LeetCode]easy - Roman to Integer - python
Problem Description:class Solution(object): def romanToInt(self, s): """ :type s: str :rtype: int """ roman = {'I':1, 'V':5, 'X':10, 'L':50, 'C':100, 'D':500, 'M':1000} z = roman[s[0]] for i
2021-09-25 10:13:57 97
原创 [LeetCode]easy - Palindrome Number - python
Problem Description:Given an integerx, returntrueifxis palindrome integer.An integer is apalindromewhen it reads the same backward as forward. For example,121is palindrome while123is not.class Solution(object): def isPalin...
2021-09-25 10:05:08 140
原创 [LeetCode]easy - Reverse Integer - python
Problem Description:Given a signed 32-bit integerx, returnxwith its digits reversed. If reversingxcauses the value to go outside the signed 32-bit integer, then return0.题目要求反转整数中的数字。思路一:首先判断原数字的正负,用flag记录一下。通过循环对10取余得到尾部数字,一步步乘10构造新的翻转后的整数。最后...
2021-09-25 00:24:26 111
原创 [LeetCode]easy - Two Sum - python
Problem Description:Given an array of integersnumsand an integertarget, returnindices of the two numbers such that they add up totarget.You may assume that each input would haveexactlyone solution, and you may not use thesameelement twice.Yo...
2021-09-24 04:56:01 110
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人