Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1) You have an array of 1 and 0
- [1,0,1,1,1,0,0,1]
- Move all the ones to the front and all the zeros to the end
- Input:
- [1,0,1,1,1,0,0,1]
- Output:
- [1,1,1,1,1,0,0,0]
- 2) Find the 3rd smallest number in an array
- Input:
- [1,2,3,4,5,6,7,8,9]
- Output:
- 3
- 3) Remove duplicate elements of an array
- Input:
- [2,2,3,3,4,4,5,6]
- Output:
- [2,3,4,5,6]
- 4) Create a class that can store infinite integers. Use array not another another thing
- class infArray{
- //Add one element to the storage
- public void add(int numToStore) {
- }
- //print all elements in the array
- public void print(){
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement