GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Hacker-Rank-Codes/Java_String_Reverse.java at master · Karthik4github/Hacker-Rank-Codes Expand file tree/ Copy pathJava_String_Reverse.javaMore file actions 34 lines (25 loc) · 665 Bytes / Copy pathJava_String_Reverse.javaFile metadata and controls34 lines (25 loc) · 665 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 /* Given a string , print Yes if it is a palindrome, print No otherwise. Constraints will consist at most lower case english letters. Sample Input madam Sample Output Yes*/ /*CODE*/ import java.io.*; import java.util.*; public class Solution { public static void main(String[] args) { Scanner sc=new Scanner(System.in); String A=sc.next(); /* Enter your code here. Print output to STDOUT. */ int i = 0, j=A.length()-1; while(A.charAt(i)==A.charAt(j) && i++<j--); if(i>j){ System.out.print("Yes"); } else System.out.print("No"); } } |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |