Capgemini Coding Interview Questions 2024-2026: 10 Real Problems with Solutions
Prepare for Capgemini coding interviews with real questions asked in 2024-2026 technical rounds. Includes detailed solutions in C++, test cases, and explanations for arrays, strings, and logic-building problems.
Capgemini Coding Interview Questions 2024-2026: 10 Real Problems with Solutions
Preparing for a Capgemini coding interview? This comprehensive guide covers 10 real coding questions asked in Capgemini technical interviews during 2024-2026. Each problem includes detailed explanations, multiple test cases, and optimized C++ solutions.
Calculate the "Reverse ASCII Sum" of a lowercase string where each character gets a reverse alphabetical value ('a'=26, 'b'=25, ..., 'z'=1), multiplied by its position (1-indexed), then summed.
#include <iostream>#include <vector>using namespace std;int main() { int N, X, Y; cin >> N; vector<pair<int, int>> segments(N); for (int i = 0; i < N; i++) { cin >> segments[i].first >> segments[i].second; } cin >> X >> Y; int total = 0; for (int p = X; p <= Y; p++) { for
Time Complexity: O((Y-X) × N) Space Complexity: O(N)
Detect if a mobile contains a virus. A string is infected (special string) if all characters at alternative positions starting from index 0 are the same.
#include <iostream>using namespace std;int sumDigits(long long n) { int sum = 0; while (n > 0) { sum += n % 10; n /= 10; } return sum;}int main() { long long A, B; cin >> A >> B; long long total = 0; for (long long i = A; i <= B;
Time Complexity: O((B-A) × log(B)) Space Complexity: O(1)
#include <iostream>#include <vector>using namespace std;void rotate(vector<int>& arr, int d, int n) { d = d % n; vector<int> rotated; for (int i = d; i < n; ++i) rotated.push_back(arr[i]); for (int i = 0; i < d; ++i) rotated.push_back(arr[i]); for (int i = 0; i
#include <iostream>#include <string>using namespace std;string compressString(string s) { if (s.empty()) return ""; string result = ""; int count = 1; for (size_t i = 1; i < s.length(); ++i) { if (s[i] == s[i-1]) { count++; } else { result += s[i-1]; if (count
These 10 Capgemini coding interview questions represent the actual problems asked in technical rounds during 2024-2026. The key to success is understanding fundamental concepts and practicing similar problems regularly.
Pro tip: Don't just memorize solutions understand the logic behind each approach. Interviewers often ask follow-up questions or variations of these problems.
Good luck with your Capgemini interview preparation!