![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法
文章平均质量分 51
Vitas
这个作者很懒,什么都没留下…
展开
-
个位数四则运算
写了一个个位数的四则运算跟大家交流,如果大家对多位数的四则运算感兴趣可以交流学习 [code="java"] import java.util.LinkedList; class Stack{ private LinkedList memory = new LinkedList(); public void push(T arg){ memory.addFirst(arg); ...原创 2013-12-04 17:55:58 · 406 阅读 · 0 评论 -
动态规划算法学习
给定待粉刷的n个墙砖(排成一行),每个墙砖可以粉刷的颜色种类为:红、蓝、绿、黄,问粉刷完毕后,红色墙砖和蓝色墙砖都是偶数的粉刷方式有多少种(结果对10007取余). 题目解析: 首先题目问红色和蓝色都是偶数的粉刷方式,由此可以得出,其他的刷黄刷绿无所谓,都可以。因此可以把颜色分为红,蓝,其它。 题目只关注奇偶,不关注具体红蓝各刷了多少块,因此我们也只分奇偶即可。 很显然前面n-1块砖...2015-07-28 22:40:48 · 79 阅读 · 0 评论 -
find the majority element
this is a question from leetcode: Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that the array is ...原创 2015-12-26 17:18:45 · 130 阅读 · 0 评论 -
find the happy number
this question is come from leetcode: Write an algorithm to determine if a number is "happy". A happy number is a number defined by the following process: Starting with any positive integer, repl...原创 2015-12-27 12:07:33 · 152 阅读 · 0 评论