CodingHuman #Coding_Help , All exam codes, Coding solutions, accenture TCS Wipro Nagarro Persistent Cisco
588 subscribers
136 photos
310 links
We Provide free material, Coding stuff, Placement material, Handwritten Notes, previous year company questions, Job updates and many more.
Conding help.
Download Telegram
int longestPalindrome(vector<string> a,int n)
{
string pair1[n];
string pair2[n];
int r = 0;
for (int i = 0; i < n; i++) {
string s = a[i];
reverse(s.begin(), s.end());
for (int j = i + 1; j < n; j++) {
if (a[i] != "" && a[j] != "") {
if (s == a[j]) {
pair1[r] = a[i];
pair2[r++] = a[j];
a[i] = "";
a[j] = "";
break;
}
}
}
}
string s1 = "";
for (int i = 0; i < n; i++) {
string s = a[i];
reverse(a[i].begin(), a[i].end());
if (a[i] != "") {
if (a[i] == s) {

s1 = a[i];
break;
}
}
}
string ans = "";
// Update the answer with
// all strings of pair1
for (int i = 0; i < r; i++) {
ans = ans + pair1[i];
}@Coding_human
// Update the answer with
// palindromic string s1
if (s1 != "") {
ans = ans + s1;
}
// Update the answer with
// all strings of pair2
for (int j = r - 1; j >= 0; j--) {
ans = ans + pair2[j];
}
return ans.size();
}

Longest palindrome

@Coding_human
CAPGEMINI ANSWERS

1.protest - organised
2. Launched
3.blank3 - changed
4. It is better - interface @Coding_human
5. Nectar- guide
6. If u have - could u stop
7. Infringed-Meddeled
8. Blank 2- remark
@Coding_human
CAPGEMINI ANSWERS

1.opposite-female
2. Preorder- 12457368
3. From the given - K
4. Sinility- vinility
5. Psuedo code - ans 2
6.sharon- no error
7. If u lead - peace on mind
8. All the bills would be sanctioned by the manager
9. She said that she had wanted to take the rest
10. Error- if u saw
11. Assume - 5432. @Coding_human
12. 17,16 - ans 5

Algorithm

1) 60
2) 2
3) 35

@Coding_human
Nick's check Solutions


class AreConsecutive
{
/* The function checks if the array elements are consecutive
If elements are consecutive, then returns true, else returns
false */
boolean areConsecutive(int arr[], int n)
{
if (n < 1)
return false;

/* 1) Get the minimum element in array */
int min = getMin(arr, n);

/* 2) Get the maximum element in array */
int max = getMax(arr, n);

/* 3) max - min + 1 is equal to n, then only check all elements */
if (max - min + 1 == n)
{
/* Create a temp array to hold visited flag of all elements.
Note that, calloc is used here so that all values are initialized
as false */
boolean visited[] = new boolean[n];
int i;
for (i = 0; i < n; i++)
{
/* If we see an element again, then return false */
if (visited[arr[i] - min] != false)
return false;

/* If visited first time, then mark the element as visited */
visited[arr[i] - min] = true;
}

/* If all elements occur once, then return true */
return true;
}
return false; // if (max - min + 1 != n)
}

/* UTILITY FUNCTIONS */
int getMin(int arr[], int n)
{
int min = arr[0];
for (int i = 1; i < n; i++)
{
if (arr[i] < min)
min = arr[i];
}
return min;
}

int getMax(int arr[], int n)
{
int max = arr[0];
for (int i = 1; i < n; i++)
{
if (arr[i] > max)
max = arr[i];
}
return max;
}

/* Driver program to test above functions */
public static void main(String[] args)
{
AreConsecutive consecutive = new AreConsecutive();
int arr[] = {5, 4, 2, 3, 1, 6};
int n = arr.length;
if (consecutive.areConsecutive(arr, n) == true)
System.out.println("Array elements are consecutive");
else
System.out.println("Array elements are not consecutive");
}
}





Oops concepts

import java.util.Arrays;

public class IntegerList {
private int[] list;
private int elementIndex = 0;


public IntegerList(int size) {
IntegerList list = new IntegerList(size);
}

public void add(int value) {
for(int i=0;i<list.length;i++) {
try{
list[i] = value;
}
catch (Exception e) {
System.out.println("Can't add, list is full");
}
}
}

public String toString() {
for(int i=0;i<list.length;i++) {
return i+ " : "+ list[i];
}
}

}



Integer arry

import java.util.Arrays;

public class IntegerList {
private int[] list;
private int elementIndex = 0;


public IntegerList(int size) {
IntegerList list = new IntegerList(size);
}

public void add(int value) {
for(int i=0;i<list.length;i++) {
try{
list[i] = value;
}
catch (Exception e) {
System.out.println("Can't add, list is full");
}
}
}



Magic ball

import java.util.*;
public class Solution{
public static void main(String args[]) throws Exception{https://t.me/Coding_human
Scanner sc = new Scanner(System.in);
int test = sc.nextInt();
while(test-->0){
int ans = 0;
int num_of_coins = sc.nextInt();
try{
if(num_of_coins<0)
throw new Exception("Enter the valid number of coins");
}
catch(Exception e){
System.out.print(e);
}

for(int i =1; i<=num_of_coins;i++){
ans+=(int) Math.pow(i,2);
}
System.out.print(ans);
}
}
}

public String toString() {
for(int i=0;i<list.length;i++) {
return i+ " : "+ list[i];
}
}

}


Nick's check Solutions

Accenture Exam

Telegram
https://t.me/Coding_human

https://t.me/Coding_human
You cannot be a master in all technologies. Master a couple and be the expert on your team or in your organization

Telegram: https://t.me/Coding_human
n=int(input())
if n%5==0:
print(-1)https://t.me/Coding_human
else:
print(n%5)n=int(input())
if n%5==0:
print(-1)
else:
print(n%5)


Python

Telegram👇
https://t.me/Coding_human
https://t.me/Coding_human
https://t.me/Coding_human

⚠️ Share post in ur college and telegram Group's
n=int(input())
if n%5==0:
print(-1)https://t.me/Coding_human
else:
print(n%5)n=int(input())
if n%5==0:
print(-1)
else:
print(n%5)


Python

Telegram👇
https://t.me/Coding_human
https://t.me/Coding_human
https://t.me/Coding_human

⚠️ Share post in ur college and telegram Group's
Tcs answers

1) 510
2) A,B, C and D
3) 109.5
4) 2.5
5- 11.11%
7.8400
8.420
9.59
10.)69

Telegram - https://t.me/Coding_human
Reasoning
1)T
2)B
3)A(Both a and R true)
4)4116
5)D(Contact to vice chancellor)
6)NWH
7)1
8)63
9)C
10)D
11)C
12)0.317:8.51
13)He would not be promoted
14)A
15)A(only assumption 1 is implicit) https://t.me/Coding_human
16)30
17) Pollution
18)(27,125,326)
19)A
20)Tjcs.
21)Father
22)B
23)only assumption 2 is implicit
24)A


Tg : https://t.me/Coding_human