TCS TCS OA-7 2024 Problem Description Given two arrays, score (an array of integers) and names (an array of strings representing candidate names), where each names[i] corresponds to a score[i]. Assume that 0≤i<n and n=score.size()=names.size(). Print the name of the candidate with the highest score.
TCS TCS OA-6 2024 Problem Description Given an array of integers, nums, print all possible combinations of the elements in nums. Each combination should include any subset of elements, from the empty set to the entire array. Input Format * The first line contains an integer N, representing the length of the array. * The second
TCS OA-5 2024 Problem Description Remove all the duplicate words from the string. Duplicate words are the ones which occurs more than ones in a string. Input Format * The first line contains a string S. Output Format Print the modified string S after removing all the duplicate words. Constraints * 1 ≤ S.length ≤ 10³
TCS OA-4 2024 Problem Description You are given an integer array nums. The unique elements of an array are the elements that appear exactly once in the array. Return the sum of all the unique elements of nums. Input Format * The first line contains an integer N, representing the length of the array.
TCS TCS OA-3 2024 Problem Description Given an integer array nums, the task is to find the contiguous subarray (containing at least one number) that has the largest sum and return that sum. Input Format * The first line contains an integer N, representing the length of the array. * The second line contains N space-separated
TCS TCS OA-2 2024 Problem Description You are tasked with writing a program to calculate the total shipping cost based on the weight of the package and the distance it needs to travel. The following criteria determine the shipping cost: 1. Base money: $5.00 (must be included in the shipping cost) 2. Cost
Accenture Accenture OA-30 2024 Problem Description You are given a function checkPassword (char str[] , int n) : Return 1 if it is a valid password else return 0 if it is not. String is a valid password if it satisfies the following conditions: * At least 4 characters. * At least 1 numeric. * At least one capital
Accenture Accenture OA-29 2024 Problem Description Alex gives you a positive number N and wants you to rearrange the bits of the number in its binary representation such that all set bits are in consecutive order. Your task is to find and return an integer value representing the minimum possible number that can be
Accenture Accenture OA-28 2024 Problem Description Let j and k be two indices in an array A. If j < k and A[j] > A[k], then the pair (j,k) is known as an "Inversion pair". You are required to implement the following function: int InversionCount(int *A, int n)
Accenture Accenture OA-27 2024 Problem Description Mr. Professor is a great scientist, but he is not able to find a solution to one problem. There are N straight lines that are not parallel, and no three lines go through the same point. The lines divide the plane into M regions. Write a function to
Accenture Accenture OA-26 2024 Problem Description It is Edward's birthday today. His friends have bought him a huge circular cake. Edward wants to find out the maximum number of pieces he can get by making exactly N straight vertical cuts on the cake. Your task is to write a function that returns
Accenture Accenture OA-25 2024 Problem Description An odd number is an integer which is not a multiple of 2. You are required to implement the following function: Int SumOddlntegers(int arr[], int n); The function accepts an integer array 'arr' of length 'n' as its argument. You are required to
TCS TCS OA-1 2024 Problem Description Given an array of integer nums and an integer k, return the total number of subarrays whose sum equals k. A subarray is a contiguous non-empty sequence of elements within an array. Input Format * The first line contains an integer N, representing the length of the array. * The
Accenture Accenture OA-24 2024 Problem Description You are given a program to find the count of magical numbers from 1 to N. A magical number is defined by the following criteria: 1. Convert to Binary: Convert each number in the range 1 to N (inclusive) to its binary representation. 2. Replace Digits: Replace '
Accenture Accenture OA-23 2024 Problem Description You are working on a financial analyzing tool which represents the daily stock prices of a company over a time. Each element in an integer array A of size N represents the closing price of the stock for a particular day. Your task is to find and return
Accenture Accenture OA-22 2024 Problem Description Two players, A and B, are playing the game of Rock, Paper, Scissors. Player A chooses a move represented by a string value M, which can be one of the following: 'rock', 'paper', or 'scissors'. The rules of the game are: * rock
Accenture Accenture OA-21 2024 Problem Description You are in charge of a convoy of N vehicles, each with a fuel meter showing the fuel present in each vehicle in liters. Each vehicle needs to travel a distance of X kilometers. If the fuel becomes empty before reaching X kilometers, the vehicle can refuel but
Accenture Accenture OA-20 2024 Problem Description You are given an integer array of size N, representing jars of chocolates. Three students A, B, and C, will pick chocolates one by one from each chocolate jar, till the jar is empty, and then repeat the same with the rest of the jars. Your task is
Accenture Accenture OA-19 2024 Problem Description You are given an integer array A of length N. Your task is to find and return an integer value representing the count of unique pairs whose product is a multiple of 3. Note: A Unique pair means that the elements must be the same regardless of their
Accenture Accenture OA-18 2024 Problem Description In a tech startup, the team faced a software bug - the zeros in their data outputs were causing their system to crash. A junior developer suggested replacing all the 0's with 5's as a quick fix. By implementing this simple code tweak, they
Accenture Accenture OA-17 2024 Problem Description You are planning a picnic for a group of friends who love math. To make it interesting, you decided to bring a unique number of items, N. Your task is to find and return an integer value representing the sum of all the prime numbers till N. In
Accenture Accenture OA-16 2024 Problem Description You are on a hiking trail represented by an array A of length N, where the trail initially ascends and then descends, forming a single peak. Your task is to find and return an integer value representing the elevation of the summit. Input Format: * Input1: An integer array
Accenture Accenture OA-15 2024 Problem Description Your friend has made an entry of a name in the form of first name F and last name L in your contact list. However, some letters in the names are in uppercase while others are in lowercase. Your task is to format the names such that the
Accenture Accenture OA-14 2024 Problem Description You are stuck on an island where they sell and eat coconut sweets only. A person can buy at most 1 box per day with each box containing N pieces. To remain alive, you must consume E coconut sweets daily for D days, but the catch is that
Accenture Accenture OA-13 2024 Problem Description You are developing a feature for an environmental awareness app that helps users to know how much area their tree's shadow covers. You have the distance D from a tree's trunk to the edge of the shadow. Your task is to calculate and return