java code to find lowest and unique number from aray
hey can any one help me??
i have 2 develop a code to find the "lowest and unique" number from a array..i thot of sorting them and then comparing the lowest number with othe numbers but i m feelin it wont work...pls help me out...
1. sort ur array
2. make a string as csv from the array elements
3. for each number in ur sorted array, check if the indexOf() and lastIndexOf() from the string return same values. Return at the first number that does so, that's ur answer.
In step 1 of method 1, don't store duplicates and the smallest number shall be answer after sorting itself.
1. Make a wrapper of all ur numbers and insert in a collection.
2. use the collection's sort method to sort them.
3. check for every number if it exists at some other index as well as the one being checked. Return the first number that dissatisfies the condition
You can use a while loop to implement the solution James suggested. Be careful not to try to indexes that are not actually in the array. And mark your threads as solved when you are satisfied with the help you've been given, or when you've found a solution, as you indicated above.
I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...
Write a C program that should create a 10 element array of random integers (0 to 9). The program should total all of the numbers in the odd positions of the array and compare them with the total of the numbers in the even positions of the array and indicate ...