2020年7月24日

摘要: 给出一个数n,求1*2*3*...*n的结果中,尾数有多少个0 这道题是一个老友跟我说是面试的题目,现在认真想一下,好像挺简单的^_^ 分析:求几个数的乘积,如果尾数为零,那么这几个数要满足的条件是:1)这几个数中有偶数;2)这几个数中包含5(包括可以分解出来的,比如整十, 2n*5) e.g: 1 阅读全文
posted @ 2020-07-24 09:05 Jain_Shaw 阅读(343) 评论(0) 推荐(0)

2020年7月4日

摘要: 编写一个程序,用以判断字符串中的括号是否匹配。 所谓的匹配,是指左右括号必须相互呼应(同种类型),可以嵌套,但不能交叉。 思想: 遇到左括号时,进栈; 遇到右括号时,判断栈是否为空,1)若栈为空,则直接返回false; 2)若栈不为空,判断栈顶元素是否与之匹配:2.1)若栈顶元素不匹配,返回fals 阅读全文
posted @ 2020-07-04 13:44 Jain_Shaw 阅读(227) 评论(0) 推荐(0)

2020年7月1日

摘要: 在Java中,所有的异常对象都是派生与java.lang.Throwable这个类。但在下一阶段,Throwable会分解成两个部分:Error与Exception。 基本上,遇到Error类的问题,都是由于系统的运行错误或者资源耗尽,而不是由于程序的设计错误。在这种情况下,我们除了将错误报告给用户 阅读全文
posted @ 2020-07-01 13:24 Jain_Shaw 阅读(173) 评论(0) 推荐(0)

2020年6月24日

摘要: 题目描述:给出字符串,求其中的最长元音字母子字符串的长度。 e.g: 输入的字符串为abbaacbioueabba, 由于元音字母是'a', 'A', 'e', 'E', 'i', 'I', 'o', 'O', 'u', 'U'这十个,在给出的字符串中,包含这十个字母的最长的子字符串的长度为5, 即 阅读全文
posted @ 2020-06-24 11:05 Jain_Shaw 阅读(1828) 评论(0) 推荐(0)

2020年6月2日

摘要: A)多线程的作用 1)发挥多核CPU的优势 现在的计算机,基本都是多核的。如果是单线程的程序,那么CPU得不到充分的利用,比如说,如果是四核的CPU,运行一个单线程程序,那么它就只是利用了其中的25%,还有75%是处于空闲的状态,这是一种“浪费”。而在单核CPU,我们所谓的“多线程”,其实是假的,在 阅读全文
posted @ 2020-06-02 01:27 Jain_Shaw 阅读(183) 评论(0) 推荐(0)

2020年5月29日

摘要: There are n cities, and the adjacency matrixarr represents the distance between any two cities.arr[i][j]represents the distance from city i to city j. 阅读全文
posted @ 2020-05-29 16:56 Jain_Shaw 阅读(306) 评论(0) 推荐(0)
摘要: Description Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connec 阅读全文
posted @ 2020-05-29 10:41 Jain_Shaw 阅读(133) 评论(0) 推荐(0)

2020年5月24日

摘要: 说明/提示 对于第1组数据,取数方式如下: [67] 75 63 10 29 29 [92] 14 [21] 68 71 56 8 67 [91] 25 >>洛谷 ————————————————————分隔线———————————————————————————————————— 对于这种题目,如 阅读全文
posted @ 2020-05-24 01:09 Jain_Shaw 阅读(396) 评论(0) 推荐(0)

2020年5月19日

摘要: Description Given a sequence of integers, find the longest increasing subsequence (LIS). You code should return the length of the LIS. 找出最长的递增子序列,遍历数组 阅读全文
posted @ 2020-05-19 10:26 Jain_Shaw 阅读(140) 评论(0) 推荐(0)

2020年5月13日

摘要: Description Given two sorted integer arrays A and B, merge B into A as one sorted array. You may assume that A has enough space (size that is greater 阅读全文
posted @ 2020-05-13 11:17 Jain_Shaw 阅读(122) 评论(0) 推荐(0)

导航