HomeIBM Off CampusIBM coding questions with answers 2023 | IBM hackerrank coding questions

IBM coding questions with answers 2023 | IBM hackerrank coding questions

- Advertisement -
Telegram Group Join Now
Instagram Page Join Now
4/5 - (4 votes)

IBM coding questions with answers 2023 2024 | IBM hackerrank coding questions : If you are looking for IBM previous year question or this year then you land on right page. Check below IBM Coding question which was asked in November 2023 Exam.

Problem Statement:

When we share our phone numbers with others, we share the numbers digit by digit.

Given a phone number in words, convert the number to digits.
For example, convert “six four eight three” to “6483”.

  1. All phone numbers will be 10 digits.
  2. Two repeating digits will be shortened using the word “double”. Three repeating
    digits will be shortened using the word “triple”. If the digits repeat four or more
    times, they will be shortered using ‘double’ and ‘triple’ mutiple times.

Check Other IBM Question Here: Question Link

IBM Latest Interview Experience: Check here


// Tech program mind
// Use this editor to write, compile and run your Java code online
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.*;

class HelloWorld {
public static void main(String[] args) {
Scanner sc = new Scanner (System.in);
String str = sc.nextLine();
String [] arr = str.split(" ");
String ans = "";
int i=0;
HashMap wordToDigitMap = new HasMap<>();
wordToDigitMap.put("zero", "0");
wordToDigitMap.put("one", "1");
wordToDigitMap.put("two", "2");
wordToDigitMap.put("three", "3");
wordToDigitMap.put("four", "4");
wordToDigitMap.put("five", "5");
wordToDigitMap.put("six", "6");
wordToDigitMap.put("seven", "7");
wordToDigitMap.put("eight", "8");
wordToDigitMap.put("nine", "9");
ans= ans+wordToDigitMap.get(arr[i+1]) + wordToDigitMap.get(arr[i+1]);
else if(arr[i].equals("triple")){
ans= ans+wordToDigitMap.get(arr[i+1]) + wordToDigitMap.get(arr[i+1]) + wordToDigitMap.get(arr[i+1]);
else {
ans= ans+wordToDigitMap.get(arr[i]);


IBM Code Explanation YouTube Video:

IBM Coding Question with answer

For More IBM Coding Question Join us:

Join Telegram (Must)Click Here
Join Experienced Job TelegramClick Here
Follow Instagram Job Page Link:Join Here


Please enter your comment!
Please enter your name here

- Advertisment -

Most Popular