(String[] args)
| 2 | |
| 3 | public class Leetcode744 { |
| 4 | public static void main(String[] args) { |
| 5 | char[] arr={'c','f','j'}; |
| 6 | char target='c'; |
| 7 | |
| 8 | int ans=ceiling(arr,target); |
| 9 | |
| 10 | if(ans==-1){ |
| 11 | System.out.println("Empty Array"); |
| 12 | } |
| 13 | else |
| 14 | System.out.println("Ceiling="+arr[ans]); |
| 15 | } |
| 16 | |
| 17 | static int ceiling(char[] arr, char target){ |
| 18 | int start=0,end=arr.length-1; |