61
剑指 Offer 61. 扑克牌中的顺子
题目描述: 从若干副扑克牌中随机抽 5 张牌,判断是不是一个顺子,即这5张牌是不是连续的。 2~10为数字本身,A为1,J为11,Q为12,K为13,而大、小王为 0 ,可以看成任意数字。A 不能视为 14。 限制: 数组长度为 5 数组的数取值为 [0, 13] . 方法:排序 + 遍历 clas ......
CS61b_最小区间排序
public static void zorkSort(int[] A, int k) { int i; int n = A.length; i = 0; PriorityQueue<Integer> pq = new PriorityQueue<>(); while (i < k) { pq.ad ......
CS61B_Hashcode
If we start with a hash table of size 2 and double when the load factor exceeds some constant. Why is this procedure for setting sizes suboptimal from ......
CS61B_时间复杂度
这是一个递归函数,其中有一个对自身的四次调用,并且在每次调用之后,输入的大小(N)减半。在函数的最后部分,有一个以Θ(N²)时间复杂度运行的函数g(N)。 现在让我们来计算这个函数的时间复杂度。 如果我们设T(N)为这个函数的时间复杂度,我们可以通过观察代码中的各个部分来构建一个递归方程。 递归的部 ......
CS61B_discussion3_week2_2
1 public class Horse { 2 Horse same; 3 String jimmy; 4 5 public Horse(String lee) { 6 jimmy = lee; 7 } 8 9 public Horse same(Horse horse) { 10 if (sam ......
CS61B_值得注意的知识
1.Golden Rule of Equals For primitives, the line int y = x copies the bits inside the x box into the y box. For reference types, we do the exact same ......
CS61B_环境配置
怎么说呢,这个环境配置花了我几乎一天的时间(呜呜呜呜,我是傻逼),ok,现在我就来分享一下我遇到的坑,和排解方法。 这篇随笔分为两个部分,第一个就是关于git仓库的创建,为后面的grade做准备;第二个就是intellij的配置。 第一部分 1.首先是创建/选择一个目录 我的电脑是macbook,我 ......
CS61B_lab02
题目描述: dcatenate(IntList A, IntList B):返回一个由A的所有元素组成的列表,后面是B的所有元素。可能会修改A。Don't use 'new'。 public static IntList dcatenate(IntList A, IntList B) { if(A ......
day61(2023.4.30)
1.循环语句之for 2.for循环语句实操 3.循环语句之while 4.break 语句和 continue 语句 5.字符串 ......
《CTFshow-Web入门》07. Web 61~70
(Web 61~70) ctf - web入门 web61~65 题解 这几个题都和 web58 一样。可能内部禁用的函数不一样吧。但 payload 都差不多。不多解释了。 以下解法随便挑一个即可。可能不同题会有部分函数被禁。 payload1: c=include "php://filter/r ......
CS61A_project_scheme
(define (list-change total denoms) (define (cons-all num ls) (let ((num-val num)) (cond ((null? ls) nil) (else (cons (cons num (car ls)) (cons-all num ......
今日报告-61
今日打卡 所花时间(包括上课):4h 代码量(行):300 发表博客:1篇(不包括本篇) 学习进度和了解到的知识点: 今天完成了团队项目表格化构建的第一阶段,前后端已经统一了,能够实现识别图片并且生成表格。一些边角的小功能也都补足了。 包括界面美化,登录注册,等。 ......
CS61A_hw09
def mutate_reverse(link): """Mutates the Link so that its elements are reversed. >>> link = Link(1) >>> mutate_reverse(link) >>> link Link(1) >>> link ......
CS61A_lab14_macro
(define-macro (switch expr cases) (cons 'cond (map (lambda (case) (cons (eq? (eval expr) (car case)) (cdr case))) cases)) ) 这段代码是一个用于 Scheme 语言的宏定义,可以 ......
CS61A_lab12_macro
(define-macro (def func args body) `(define ,(cons func args) ,body)) 分析: 定义一个万能的函数定义,那就要模拟函数定义的样子。ok,函数定义是什么样子的呢? eg: (define (filter-lst fn lst) (if ......
cs61c 环境配置
关于java环境: https://www.oracle.com/java/technologies/javase-jdk16-downloads.html 在这个网站下载比较新的java安装文件,比如deb 使用这个命令注册新安装的java并且设置优先级(随便,比如1700) sudo updat ......
CS61A_hw07
#lang sicp (define (unique s) (if (null? s) nil (cons (car s) (unique (filter (lambfa (x) (not (eq? x (car s)))) (cdr s))) ) ) ) 这是一个Scheme函数,名为unique ......
CS_61A_lab10
Write sub-all, which takes a list s, a list of old words, and a list of new words; the last two lists must be the same length. It returns a list with ......
CS_61A_ant
def reduce_armor(self, amount): """Reduce armor by AMOUNT, and remove the FireAnt from its place if it has no armor remaining. Make sure to damage eac ......
CS_61A_hw6
题目: def is_bst(t): """Returns True if the Tree t has the structure of a valid BST. >>> t1 = Tree(6, [Tree(2, [Tree(1), Tree(4)]), Tree(7, [Tree(7), Tr ......
61、Prometheus-Consul分布式集群部署
1、简介 1.1、Consul介绍 Consul 是基于 GO 语言开发的开源工具,主要面向分布式,服务化的系统提供服务注册、服务发现和配置管理的功能。Consul 提供服务注册/发现、健康检查、Key/Value 存储、多数 据中心和分布式一致性保证等功能。Prometheus 通过 Consul ......
用 Go 剑指 offer:面试题61. 扑克牌中的顺子
从若干副扑克牌中随机抽 5 张牌,判断是不是一个顺子,即这5张牌是不是连续的。2~10为数字本身,A为1,J为11,Q为12,K为13,而大、小王为 0 ,可以看成任意数字。A 不能视为 14。 示例 1: 输入: [1,2,3,4,5]输出: True 示例 2: 输入: [0,0,1,2,5]输 ......
Python 小型项目大全 61~65
六十一、ROT13 密码 原文:http://inventwithpython.com/bigbookpython/project61.html ROT13 密码是最简单的加密算法之一,代表“旋转 13 个空格”密码将字母A到Z表示为数字 0 到 25,加密后的字母距离明文字母 13 个空格: A变 ......
CS61A_lab08
题目: Write the generator function make_generators_generator, which takes a zero-argument generator function g and returns a generator that yields gener ......
牛客小白月赛61 ABCE*
https://ac.nowcoder.com/acm/contest/46597 ###A-超市里扫货 #include<bits/stdc++.h> using namespace std; typedef long long LL; typedef pair<LL,LL> PII; const ......
CS61A_未解决
def close(n, smallest=10, d=10): """ A sequence is near increasing if each element but the last two is smaller than all elements following its subsequ ......
CS61A_lab_07
Problem 2 题目描述: 代码: 1 def inc_subseqs(s): 2 """Assuming that S is a list, return a nested list of all subsequences 3 of S (a list of lists) for which ......
CS61A Fall 2020 Lab 5 Data Abstraction, Trees 我的思路
Description: https://inst.eecs.berkeley.edu/~cs61a/fa20/lab/lab05/ Optional Questions Tree - Q10: Add Trees (不会做,是老师的讲解) Define the function add_trees ......