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.