Tag: algorithm
The twin of a word is a word written with the same letters (independent of case), but not necessarily in the same order.For example “Outlook” is the twin of “Lookout”. The isTwin(a, b) method returns true if b is the twin of a or false if it is not. a . . . Read more
We consider the sequence of numbers in which a number is followed by the same number plus the sum of these digits. For example 34 is followed by 41 (41 = 34 + (3+4)). 41 is itself followed by 46 (46 = 41 + (4+1)). Two sequences with different starting . . . Read more
Check if a string is composed of parentheses and square brackets recursively in Java The program below identifies a string composed of parentheses ( ) and square brackets [ ]. A string of this type is considered correct : If it is an empty string or null If the string . . . Read more
Find the closest (nearest) integer in the array to zero. Output :