
In this post, you will get the solution to the Capgemini ADAPT 2022 solution to the problem of String Combinations in Java. Capgemini ADAPT Java Solutions 2022, String Combinations.
Note: The solutions are provided for learning purposes only.
Table of Contents
- String Combinations Problem Description:
- Capgemini ADAPT 2022 – String Combinations Problem Solution in Java:
- To Stay Up-to-date, Follow us on Social Media:
- ADAPT Different Coding Solutions:
- Capgemini ADAPT Sprint 1 (Bus Reservation Solutions):
- Capgemini ADAPT Sprint 2 (Bus Reservation System):
- Study Materials for Interview Preparation (FREE MATERIALS):
String Combinations Problem Description:
Write a program in Java to accept a four-letter word. Display all the probable four-letter combinations such that no letters should be repeated in the output within each combination.
Sample Input:
PARK
Sample Output:
PAKR, PKAR, PRAK, APRK, ARPK, AKPR, and so on.
Execution Time Limit:
10 seconds
Capgemini ADAPT 2022 – String Combinations Problem Solution in Java:
import java.util.Scanner; public class KboatStringCombinations { public static void main(String args[]) { Scanner in = new Scanner(System.in); System.out.println("Enter a word:"); String str = in.nextLine(); int len = str.length(); if (len != 4) { System.out.println("Invalid Input!"); System.out.println("Please enter a four letter word"); return; } for (int i = 0; i < len; i++) { for (int j = 0; j < len; j++) { for (int k = 0; k < len; k++) { for (int l = 0; l < len; l++) { if (i != j && i != k && i != l && j != k && j != l && k != l) { System.out.print(str.charAt(i)); System.out.print(str.charAt(j)); System.out.print(str.charAt(k)); System.out.println(str.charAt(l)); } } } } } } }
TOP COMPANIES HIRING DRIVE |
BATCHWISE OFF-CAMPUS DRIVES |
1. TCS OFF-CAMPUS DRIVES | 1. 2018 BATCH |
2. INFOSYS OFF-CAMPUS DRIVES | 2. 2019 BATCH |
3. COGNIZANT OFF-CAMPUS DRIVES | 3. 2020 BATCH |
4. WIPRO OFF-CAMPUS DRIVES | 4. 2021 BATCH |
5. CAPGEMINI OFF-CAMPUS DRIVES | 5. 2022 BATCH |
To Stay Up-to-date, Follow us on Social Media:
1. Join our Telegram Channel: |
Click Here |
2. Like us on Facebook: |
Click Here |
3. Follow us on Instagram: |
Click Here |
4. Follow us on LinkedIn: |
Click Here |
5. Follow us on Google News: |
Click Here |
ADAPT Different Coding Solutions:
- Largest Array Solution – Click Here
- Batsman & Bowler Solution – Click Here
- String Combinations Problem Solution – Click Here
- Check Two Person Are Same – Click Here
- String Combinations ADAPT Solution – Click Here
- String Combination Capgemini ADAPT Solution – Click Here
Capgemini ADAPT Sprint 1 (Bus Reservation Solutions):
- 1. Capgemini ADAPT Sprint 1 Bus Reservation System – DisplayCustomerInAscendingOrder Problem Solution
- 2. Capgemini ADAPT Sprint 1 Bus Reservation System – DisplayCustomerByFirstName Problem Solution
- 3. Capgemini ADAPT Sprint 1 Bus Reservation System – SortByCustomerId Problem Solution
- 4. Capgemini ADAPT Sprint 1 Solution Java | LSAByCustomerName Problem Solution
- 5. Capgemini ADAPT Sprint 1 Case Study Solution Java | BSAByCustomerId Problem Solution
Capgemini ADAPT Sprint 2 (Bus Reservation System):
- 1. Capgemini ADAPT Sprint 2 Case Study (Bus Reservation System) Solution | HAS-A-Relationship Solution Java
- 2. Capgemini ADAPT Sprint 2 Case Study (Bus Reservation System) Solution OOPs-Para-Constructor Java
- 3. Capgemini ADAPT Sprint 2 Bus Reservation System (CRUDOperations) Problem Solution
Study Materials for Interview Preparation (FREE MATERIALS):
- 240 Core Java Questions & Answers with PDF Download Link – Click Here
- 230+ SQL interview questions & answers pdf download – Click Here
- 50 LeetCode Interview Questions with Answers – PDF Notes – Click Here