Advertisement
Flaron

ProgMasters 16 - Mirror

Jun 18th, 2019
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. 16 - Mirror
  2.  
  3. Test
  4. We'll say that a "mirror" section in an array is a group of contiguous elements, such that somewhere in the array, the same group appears in reverse order. For example, the largest mirror section in {1, 2, 3, 8, 9, 3, 2, 1} is length 3 (the {1, 2, 3} part), or in {1, 2, 1, 3} it's 3 as well (the {1, 2, 1} part). Return the size of the largest mirror section found in the given array.
  5.  
  6. HINT: There might be negative numbers as well!
  7.  
  8. Input Format
  9. The first line contains a single integer, n, denoting the size of the array. Each of the subsequent n lines contains a single integer denoting the value of the array at the next position.
  10.  
  11. Output Format
  12. A number.
  13.  
  14.  
  15. Sample input
  16. 7
  17. 7
  18. 1
  19. 2
  20. 9
  21. 7
  22. 2
  23. 1
  24.  
  25. Sample output
  26. 2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement