算法
文章平均质量分 64
阿蛮家
Andriod、Java技术分享
展开
-
算法题目二:找到数组中迷失的数字
public class TestTwo { public static void main(String[] args) { int[] str = {2,4,1,5}; System.out.print(solution2(str)); } public static int solution(int[] A){ int原创 2016-03-06 16:00:36 · 373 阅读 · 0 评论 -
算法题目三:判断数组中任意三条边能否组成一个三角形,若能返回1,不能返回0
算法一:正确率90%,算法效率分0% 算法二:正确率,算法效率均100% public class Triangle { public static void main(String[] args) { int[] str = {10,2,5,1,8,20}; System.out.println(solution(str));原创 2016-03-06 16:08:19 · 1857 阅读 · 0 评论 -
算法题目一:如果数组中数字重复最多的次数大于数组长度的一半,返回1,否则返回0
public class TestOne { public static void main(String[] args) { int[] str = {5,5,5,5,5,5,5,5,5,5,5,5,4,4,4,6,4,6,3,7}; System.out.println(solution(str)); } public static i原创 2016-03-06 15:58:58 · 610 阅读 · 0 评论