摘要:
一、题目 二、解法 本题是二分法的变种。和标准二分问题的不同在于,二分后,两个区间不都是有序的,但必有一个有序,另一个可能有序也可能无序。 class Solution { public int search(int[] nums, int target) { int len=nums.length 阅读全文
摘要:
lab5 Y86-64 Assembler笔记 本lab需要编写汇编器(assembler),将Y86-64的汇编代码转换为二进制代码。代码文件:y64sam.c 头文件重要数据结构 /* Table used to encode information about instructions */ 阅读全文
摘要:
lab6 piplined processor笔记 part A 主要是写汇编代码。比较简单,略过 part B 比较简单,略过 part C 修改pipe-full.hcl和ncopy.ys,保证程序正确性的同时,使得程序运行越快越好。 要求: pipe-full.hcl:实现iaddq指令 nc 阅读全文
摘要:
class Solution { public int maxProfit(int[] prices) { int len=prices.length; // 0: no stock; 1: hold stock; 2: no stock & in frozen stage int[] dp=new 阅读全文
摘要:
本质和买卖股票的最佳时机3一样。 class Solution { public int maxProfit(int k, int[] prices) { int len=prices.length; if(len==0||k==0) return 0; int k2=k*2; int[] dp=n 阅读全文