Question Index

Write a program to find the most similar name to the given name. Assume that the most similar name is the one with minimum ASCII code difference. Compute the total of all characters ASCII code and then compare.

Input (List, String) Output (String)
[Ramesh, Suresh, Naresh], Rajesh Ramesh
[Arjun, Ravi, Karan], Varun Arjun
[Nithish, Jathish, Sathish], Sirish Jathish

import java.util.*;
class SimilarNameUsingAsciiCode
    public static void main(String s[])
        List<String> names = new ArrayList<String>();
        String input = "Sirish";
        System.out.println("The most similar name using the ASCII code difference method is : " + getMostSimilarName(names, input));


    public static String getMostSimilarName(List<String> listOfNames, String input) {




Topic: Java ArrayList

Read this topic
Take test on this topic

Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App