Aug Last Week Coding Questions Accenture
Aug Last Week Coding Questions Accenture
QUESTIONS
2025
youtube.com/@teknouf
UBK ANNA
UF
O
KN
TE
12,24,35,9
8
3
0
4
2025
youtube.com/@teknouf
UBK ANNA
public class Main {
public static int findIndexOfDividend(int[] arr, int divisor, int
remainder, int quotient) {
for (int i = 0; i < arr.length; i++) {
if (arr[i] / divisor == quotient && arr[i] % divisor ==
UF
remainder) {
return i; // 12/8=3,24%8==0,2,21 // 1
}
}
return -1;
}
System.out.println(index);
}
}
TE
2025
youtube.com/@teknouf
UBK ANNA
def find_index_of_dividend(arr, divisor, remainder, quotient):
for index, dividend in enumerate(arr):
if dividend // divisor == quotient and dividend % divisor ==
remainder:
return index
return -1
UF
arr = [12, 2, 2, 21]
divisor = 8
remainder = 0
quotient = 3
2025
youtube.com/@teknouf
UBK ANNA
UF
O
KN
TE
2025
youtube.com/@teknouf
UBK ANNA
Input: `S = "HTHHTTHTHHHT"`
- Output:`Score = 10`
Explanation:
- H (Score: 2)
- T (Score: 1)
- H (Score: 3)
UF
- H (Score: 5)
- T (Score: 4)
- T (Score: 3)
- H (Score: 5)
- T (Score: 4)
- H (Score: 6)
- H (Score: 8)
- H (Score: 10) → Stop here (3 consecutive heads), final score = 10
O
Example 2:
- Input:S = "TTTHHTT"`
KN
- Output:Score = -1`
Explanation:
- T (Score: -1)
- T (Score: -2)
- T (Score: -3)
- H (Score: -1)
TE
- H (Score: 1)
- T (Score: 0)
- T (Score: -1) → Entire string processed, final score = -1
2025
youtube.com/@teknouf
UBK ANNA
public class Main {
UF
for (int i = 0; i < S.length(); i++) {//HTHHTTHTHHHT
char toss = S.charAt(i); // H
if (toss == 'H') {
score += 2;// 10
countHeads += 1; // 3
} else {
score -= 1; // 1
O
countHeads = 0;
}
KN
if (countHeads == 3) {
break;
}
}
return score;
}
TE
2025
youtube.com/@teknouf
UBK ANNA
def toss_and_score(S):
score = 0
count_heads = 0
UF
if toss == 'H':
score += 2
count_heads += 1
else:
score -= 1
count_heads = 0
if count_heads == 3:
O
break
return score
KN
print(toss_and_score("HTHHTTHTHHHT"))
#print(toss_and_score("TTTHHTT"))
TE
2025
youtube.com/@teknouf
UBK ANNA
UF
O
KN
OUTPUT: 17
TE
2025
youtube.com/@teknouf
UBK ANNA
array1 = [1, 2, 3]
array2 = [4, 2, 3]
result = []
for i in range(len(array1)):
result.append(array1[i] * array2[i])
UF
total_sum = 0
for value in result:
total_sum += value
print(total_sum)
O
KN
TE
2025
youtube.com/@teknouf
UBK ANNA
public class Main {
public static void main(String[] args) {
int[] array1 = {1, 2, 3};
int[] array2 = {4, 2, 3};
if (array1.length != array2.length) {
UF
System.out.println("Arrays must be of the same length.");
return;
}
int totalSum = 0;
for (int i = 0; i < array1.length; i++) {
int product = array1[i] * array2[i];
totalSum += product;
O
}
System.out.println(totalSum);
}
KN
}
TE
2025
youtube.com/@teknouf
UBK ANNA
UF
O
KN
TE
OUTPUT : 5
2025
youtube.com/@teknouf
UBK ANNA
public class Main {
public static void main(String[] args) {
int[] A = {5,3};
int N = A.length;
UF
System.out.println(summitElevation);
}
}
}
return summit;
}
}
TE
2025
youtube.com/@teknouf
UBK ANNA
def find_summit_elevation(A, N):
summit = A[0]
UF
break
return summit
A = [1, 2, 3, 4, 3, 2, 1]
N = len(A)
summit_elevation = find_summit_elevation(A, N)
O
print(summit_elevation)
KN
TE
2025
youtube.com/@teknouf
UBK ANNA
UF
O
KN
TE
2025
youtube.com/@teknouf
UBK ANNA
def count_lowercase_letters(s):
count = 0
for char in s:
if char.islower():
count += 1
UF
return count
input_string = "teTinG"
lowercase_count = count_lowercase_letters(input_string)
print(lowercase_count)
O
KN
TE
2025
youtube.com/@teknouf
UBK ANNA
def count_lowercase_letters(s):
count = 0
for char in s:
if char.islower():
count += 1
UF
return count
input_string = "teTinG"
lowercase_count = count_lowercase_letters(input_string)
print(lowercase_count)
O
KN
TE
2025
youtube.com/@teknouf
UBK ANNA
public class Main {
public static void main(String[] args) {
String inputString = "Test String.";
UF
System.out.println(lowercaseCount);
}
return count;
}
}
TE
2025
youtube.com/@teknouf
UBK ANNA
UF
O
KN
TE
2025
youtube.com/@teknouf
UBK ANNA
import java.util.*;
public class Main {
UF
System.out.println("Enter the moves:");
String str=sc.next();
System.out.println("The number of successful move by
A:"+checkA(str,n));
}
if(snakeorwater(str,i)) {
count++;
i=i+10;}
else {
if(str.charAt(i+5)=='s') {
i=i+10;
}
TE
else {
i=i+8;
}
}
}
2025
youtube.com/@teknouf
UBK ANNA
else if(str.charAt(i)=='w') {
if(snakeorwater(str,i)) {
count++;
i=i+8;
}
else
i=i+10;
UF
}
else {
if(gun(str,i)) {
count++;
i=i+8;
}
else {
if(str.charAt(i+3)=='w') {
O
i=i+8;
}
else
i=i+6;
KN
}
}
}
return count;
}
TE
2025
youtube.com/@teknouf
UBK ANNA
public static boolean snakeorwater(String str,int i) {
if(str.charAt(i)=='s') {
if(str.charAt(i+5)=='w') {
return true;
}
else
UF
return false;
}
else
{
if(str.charAt(i+5)=='g') {
return true;
}
else
O
return false;
}
}
public static boolean gun(String str,int i) {
KN
if(str.charAt(i+3)=='s') {
return true;
}
else
return false;
}
}
TE
2025
youtube.com/@teknouf
UBK ANNA
AFFORDABLE PLACEMENT MATERIALS
UF
O
69 X 6 = 414/- PAY ONLY
KN
249/-
TO GET 👆🏽
DM - 👇🏽
TE
INSTAGRAM.COM/TEKNO.UF
2025
youtube.com/@teknouf
UBK ANNA