dmndxld

码不停题

2021年1月30日

c++小数点后舍入

摘要: c++ math.h中有这么几种函数:round,floor,ceil,trunc round提供四舍五入,floor向下取整,ceil向上取整,trunc截断 例子 /* round vs floor vs ceil vs trunc */ #include <stdio.h> /* printf 阅读全文

posted @ 2021-01-30 10:28 imyourterminal 阅读(388) 评论(0) 推荐(0) 编辑

2019年8月8日

关于类里再声明自身类实例的思考

摘要: 类似这种 还是当初学的不精啊!! 这样只是声明而已 并没有创建实例 如果是类里面new出一个实例 然后再在别的地方实例化调用这个类 那么就会报错 Exception in thread "main" java.lang.StackOverflowError 这里感觉跟c++里面的struct结构体很 阅读全文

posted @ 2019-08-08 11:12 imyourterminal 阅读(228) 评论(0) 推荐(0) 编辑

2019年7月20日

Java集合

摘要: 集合 概述 集合与数组类似,也是一种引用类型,也可以存放很多个数据。但是数组的长度不可改变,而集合的长度是可变的,所以使用更加方便。 集合有很多种,现阶段我们学习最为简单的java.util.ArrayList集合。 构造方法 创建一个ArrayList,最常用的就是默认无参数的构造方法: l pu 阅读全文

posted @ 2019-07-20 11:18 imyourterminal 阅读(130) 评论(0) 推荐(0) 编辑

2019年7月1日

Python图片转字符画

摘要: 七月一号!!!新的一月开始了!!!不能再懒惰了阿!!!! 冲冲冲 这个暑假好好学一下python!!! 今天实现简单的项目:图片转字符画 主要步骤为:1.安装pillow包 2.命令行输入参数处理并获取参数,目标是获取输入的图片路径、输出字符画的宽和高以及输出文件的路径 3.实现RGB值转字符的函数 阅读全文

posted @ 2019-07-01 23:09 imyourterminal 阅读(383) 评论(0) 推荐(0) 编辑

2019年5月19日

102. Binary Tree Level Order Traversal

摘要: Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level). For example:Given binary tree [3 阅读全文

posted @ 2019-05-19 20:56 imyourterminal 阅读(108) 评论(0) 推荐(0) 编辑

2019年5月15日

1041. Robot Bounded In Circle

摘要: On an infinite plane, a robot initially stands at (0, 0) and faces north. The robot can receive one of three instructions: "G": go straight 1 unit; "L 阅读全文

posted @ 2019-05-15 21:44 imyourterminal 阅读(190) 评论(0) 推荐(0) 编辑

2019年5月13日

144. Binary Tree Preorder Traversal

摘要: Given a binary tree, return the preorder traversal of its nodes' values. Example: My idea:ricursion OTHERS:iretator 阅读全文

posted @ 2019-05-13 21:46 imyourterminal 阅读(155) 评论(0) 推荐(0) 编辑

2019年5月12日

283. Move Zeroes

摘要: Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements. Example: Note: M 阅读全文

posted @ 2019-05-12 18:05 imyourterminal 阅读(153) 评论(0) 推荐(0) 编辑

26. Remove Duplicates from Sorted Array

摘要: Given a sorted array nums, remove the duplicates in-place such that each element appear only once and return the new length. Do not allocate extra spa 阅读全文

posted @ 2019-05-12 12:08 imyourterminal 阅读(185) 评论(0) 推荐(0) 编辑

2019年5月11日

151. Reverse Words in a String

摘要: Given an input string, reverse the string word by word. My idea:删除左右两边空格,转换成数组,再把中间空格给改了,再专成字符串,用快慢指针找到单词放进去,很麻烦,所以效果不好。 执行用时 : 92 ms, 在Reverse Words 阅读全文

posted @ 2019-05-11 17:36 imyourterminal 阅读(202) 评论(0) 推荐(0) 编辑

导航