Advertisement
Guest User

Untitled

a guest
Jan 16th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. /**
  2. * Given: An array of strings where L indicates land and W indicates water,
  3. * and a coordinate marking a starting point in the middle of the ocean.
  4. *
  5. * Challenge: Find and mark the ocean in the map by changing appropriate Ws to Os.
  6. * An ocean coordinate is defined to be the initial coordinate if a W, and
  7. * any coordinate directly adjacent to any other ocean coordinate.
  8. *
  9. * void findOcean(String map, int row, int column);
  10. *
  11. * String map = new String{
  12. * “WWWLLLW”,
  13. * “WWLLLWW”,
  14. * “WLLLLWW”
  15. * };
  16. * printMap(map);
  17. *
  18. * STDOUT:
  19. * WWWLLLW
  20. * WWLLLWW
  21. * WLLLLWW
  22. *
  23. * findOcean(map, 0, 1);
  24. *
  25. * printMap(map);
  26. *
  27. * STDOUT:
  28. * OOOLLLW
  29. * OOLLLWW
  30. * OLLLLWW
  31. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement