列表 第页
我想根据偶数和奇数 $指数属性过滤一个数组,我想在另一个div添加奇数元素在一个单独的分区,甚至元素,我可以这样做很容易在JavaScript或jQuery的,但我想知道要实现AngularJS相同的正确方法。I want to filter an array based on even and odd $index...阅读全文
我已经实现一种算法以改变阵列,使所有的偶数被移动到阵列和旧号码到阵列的端部的开始。这是我的计划: - I have implemented an algorithm to change an array so that all the even numbers are moved to the beginning...阅读全文
可能重复: 找到一个单一的数字在列表 什么是给定整数数组好的算法,所有,但其中一个出现的偶数次,找到一个整数出现的次数为奇数What to be a good algorithm given an array of integers, all but one of which appears an even nu...阅读全文
我有序列号生成程序,我需要它来搜索最小的正数为帕斯卡一个奇数位置。I have array number generator program and I need it to search smallest positive number that is a odd number position in Pascal...阅读全文
我已编写的程序来放置所述阵列的左侧和奇数那些所有偶数元素到阵列的右半部。元素的顺序是令人关注的不是。我想知道是否有更高效的算法比这一点。我的最坏情况复杂度为O(n / 2)。这里是code。//程序却将所有的偶数阵列中的左奇的权利。顺序的数字并不重要。导入的java.util。*;进口的java.lang。*;进口...阅读全文
鉴于项的非空数组。你必须移动从右侧的所有项目,以奇位置(从零开始),并从左侧 - 甚至位置,如下所示:Given a non-empty array of items. You have to move all the items from the right side to odd positions (zero-...阅读全文
由于是整数数组。阵列中的每个号码的出现次数为奇数,但是只有1号发生的偶数次。找到这个数字。Given is an array of integers. Each number in the array occurs an ODD number of times, but only 1 number is occurr...阅读全文
我遇到以下问题:查找数组中的其中出现次数奇数的所有元素。'Find all the elements in an array which occur odd number of times'.我的这个想法是:使用的HashMap :添加值的数组作为HashMap的键研究。对应于每个键的值将是倍键遇到号Use Ha...阅读全文
我回来了另一个类似的问题。我目前工作的一个Java程序,将检查如果一个图是2 - 着色,即,如果它不包含奇周期(奇数长周期)。整个算法应该运行在O(V + E)时(V为所有顶点和E是图中的所有边)。我现在的算法做了深度优先搜索,记录在它采取的路径上的所有顶点,然后查找后边缘,然后记录之间顶点的边缘之间。接着,它跟踪从...阅读全文
您有(比单发生,但更),其中每一个数字是重复的次奇数阵列。整整一个号码出现一次。你怎么发现,只出现一次的多少?You have an array in which every number is repeated odd number of times (but more than single occurrence...阅读全文
考虑到与正和负整数的数组,将所有的奇数索引元素的左侧和偶索引元素向右这个问题的困难之处是做就地同时维持秩序。例如。7,5,6,3,8,4,2,1输出应该是:5,3,4,1,7,6,8,2快速排序如果订单没有问题,我们本来可以使用的分区()算法。如何做到在O(N)?解决方案 在获取最大的有子数组大小3 K +1...阅读全文
如何使用 Java 8 的流方法拆分奇数和偶数并在集合中求和?How can I split odd and even numbers and sum both in a collection using stream methods of Java 8?public class SplitAndSumOddEve...阅读全文
我需要拆分一个字符串,它看起来像这样I need to split a string that looks like this1052 root 0 SW< [hwevent]为以下1052root0SW<[hwevent]当然,我可以只掀起forloop和空格比较字符索引,当发生不是空...阅读全文
我的奇数定义如下:Definition Odd n := exists k, n = 2*k+1.我有一个奇数定义,即一个数字是否为奇数。Fixpoint oddb (n : nat) { struct n } : bool :=match n with| 0 => false| 1 => true| S (S n...阅读全文