# Python program to check if a string is # palindrome or not # function to check palindrome string def isPalindrome(string): rev_string = string[::-1] return string == rev_string # Main code x = "Google" if isPalindrome(x): print(x,"is a palindrome string") else: print(x,"is...
// Java program to check whether a class is declared// as an enum or notenumA{RED,GREEN,BLUE;}publicclassMain{publicstaticvoidmain(String[]args)throwsClassNotFoundException{Class cls1=A.class;Class cls2=Main.class;if(cls1.isEnum())System.out.println("The cls1 is representing a Enum")...
If equal, it is an armstrong number. If not, it isn't. Here's the equivalent Java code: Java Program to Check Armstrong Number Example 2: Check Armstrong number for n digits fun main(args: Array) { val number = 1634 var originalNumber: Int var remainder: Int var result = 0 var n...
METHOD 01: In this, we will use the length property to check if the array is empty or not. The length property of an array will check the length of the array and return a number value. The index of an array starts at 0, but the length is counted from 1, so the length of an ...
Palindrome in JavaScript With Built-in Functions JavaScript provides several functions that we can use to detect whether a string is a palindrome or not. First, convert the string into an array using thestring.split()function. Thesplit()methodis a built-in method provided by JavaScript. This ...
using System;using System.Linq;namespace palindrome{class Program{publicstaticboolcheckPalindrome(string mainString){string firstHalf=mainString.Substring(0,mainString.Length/2);char[]arr=mainString.ToCharArray();Array.Reverse(arr);string temp=newstring(arr);string secondHalf=temp.Substring(0,temp.Len...
Below is an example to find if the string is a palindrome using JavaScript String and Array Methods ? Open Compiler // Function to check for Palindrome function isPalindrome(str) { const lowerCaseStr = str.toLowerCase(); const modifiedStr = lowerCaseStr.replace(/[\W_]/g, ''); const re...
Sunny Number Program in Java Java Program to reverse the Array java program to check palindrome string using recursion System.out.println(“Enter a number for check in main method:”); int n = scan.nextInt(); int count = 0; } }
is.array(value:any) Checks if the given value type is array. interfaces: not, all, any is.array(['foo','bar','baz'])=>trueis.not.array({foo:'bar'})=>trueis.all.array(['foo'],'bar')=>falseis.any.array(['foo'],'bar')=>true// 'all' and 'any' interfaces can also take...
What is Blocking Deque in Java? How and When to us... How to find 2nd, 3rd or kth element from end in li... 10 Examples of an Array in Java Top 40 Perl Interview Questions and Answers for Pr... 3 Examples of flatMap() of Stream in Java ...