Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- list{1,4,7,6}
- getNearestTop(int input){
- return list.OrderBy(i => i)
- .First();
- }
- getNearestBottom(int input){
- return list.OrderBy(i => i)
- .Last();
- }
- getNearestBottom(5) should return 4
- getNearestTop(5) should return 6
- getNearestBottom(4) should return 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement