Advertisement
updown

Untitled

Sep 10th, 2021
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1.  
  2. 1. Read in input, store it in 2 arrayLists, one with the x coordinates and one with the y coordinates
  3.  
  4. // Point 1 is top point
  5. // First find the top most point
  6. Loop through all the points and find the index of the point with the maximum y coordinate
  7. int max = 0;
  8. for (int i=0; i<N; i++) {
  9. if (y.get(i) >y.get(max)) {
  10. max = i;
  11. }
  12. }
  13.  
  14. // Find the area if we remove the top most point - loop through all the points except max and find maxx, minx, maxy, and miny
  15.  
  16.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement