Advertisement
Guest User

Untitled

a guest
Jul 21st, 2019
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. 1) You have an array of 1 and 0
  2. [1,0,1,1,1,0,0,1]
  3. Move all the ones to the front and all the zeros to the end
  4. Input:
  5. [1,0,1,1,1,0,0,1]
  6. Output:
  7. [1,1,1,1,1,0,0,0]
  8.  
  9. 2) Find the 3rd smallest number in an array
  10. Input:
  11. [1,2,3,4,5,6,7,8,9]
  12. Output:
  13. 3
  14.  
  15. 3) Remove duplicate elements of an array
  16. Input:
  17. [2,2,3,3,4,4,5,6]
  18. Output:
  19. [2,3,4,5,6]
  20.  
  21. 4) Create a class that can store infinite integers. Use array not another another thing
  22.  
  23. class infArray{
  24. //Add one element to the storage
  25. public void add(int numToStore) {
  26. }
  27. //print all elements in the array
  28. public void print(){
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement