L&T Coding Questions with Solutions 2024 | L&T Coding Questions | LTI Coding Questions and Answers | L&T Coding Questions and Answers Pdf
L&T Coding Questions with Solutions 2024: The Coding Questions and Answers is very important in the IT Sector and Private Job Sector. Now days candidates are mostly interested in the off-Campus drive and private jobs. Eagerly prepare for the Coding Interview, Assessment Test, and attend the many samples online test for Private jobs. Following of the hiring, L&T issued the Off Campus Drive for eligible and capable candidates. The L&T Off Campus Drive selection process coding test, technical test etc., The Coding Interview round will be asked many questions through sample of C, C++, Java, Python Programming Languages. Thoroughly prepare for the L&T Coding Interview. Here we uploaded major common L&T Coding Questions and L&T Coding Questions with Answers. Applicants must prepare LTI Coding Questions and Answers.
You have spent a time to solve the L&T Coding Questions while using this page. The Very L&T Coding Interview questions consist of each programming languages. So, candidates prepare all programming languages on one by one. Variety of the sample L&T Coding Interview Questions makes confidence to attend the L&T Off Campus drive. Once you have selected in the LTI coding Interview round, you will be move on further selection process. The coding interview round is main part of the L&T Hiring. Candidates focused to prepare LTI Coding Questions and L&T Coding Interview Questions and Answers.
L&T Coding Questions and Answers
Q) Johnny was absent in his english class when the vowel topic was taught by the teacher . His english teacher gave him two strings and told him to find the length of the longest common subsequence which contains only vowels, as a punishment for not attending english class yesterday .
Help Jhonny by writing a code to find the length of the longest common subsequence
Input Specification:
- input1: First string given by his teacher
- input2: Second string given by his teacher.
Output Specification:
- Return the length of the longest common subsequence which contains only vowels.
Example 1:
vowelpunish
english
Output : 2
Example 2:
prepinsta
prepare
Output : 2
C++ Program
#include <bits/stdc++.h>
using namespace std;
bool isVowel (char ch)
{
if (ch == 'a' || ch == 'e' || ch == 'i' ||ch == 'o' || ch == 'u')
return true;
return false;
}
int lcs (char *X, char *Y, int m, int n)
{
int L[m + 1][n + 1];
int i, j;
L[i][j] contains length of LCS of X[0..i - 1] and Y[0..j - 1]
for (i = 0; i <= m; i++)
{
for (j = 0; j <= n; j++)
{
if (i == 0 || j == 0)
L[i][j] = 0;
else if ((X[i - 1] == Y[j - 1]) && isVowel (X[i - 1]))
L[i][j] = L[i - 1][j - 1] + 1;
else
L[i][j] = max (L[i - 1][j], L[i][j - 1]);
}
}
return L[m][n];
}
int main ()
{
char X[];
char Y[];
cin >> X;
cin >> Y;
int m = strlen (X);
int n = strlen (Y);
cout << lcs (X, Y, m, n);
return 0;
}
JAVA PROGRAM
import java.util.*;
public class Main
{
static boolean Vowel(char ch)
{
if (ch == 'a' || ch == 'e' ||ch == 'i' || ch == 'o' ||ch == 'u')
return true;
return false;
}
static int Lcs(String X, String Y, int m, int n)
{
int L[][] = new int[m + 1][n + 1];
int i, j;
for (i = 0; i <= m; i++)
{
for (j = 0; j <= n; j++)
{
if (i == 0 || j == 0)
L[i][j] = 0;
else if ((X.charAt(i - 1) == Y.charAt(j - 1)) &&Vowel(X.charAt(i - 1)))
L[i][j] = L[i - 1][j - 1] + 1;
else
L[i][j] = Math.max(L[i - 1][j],L[i][j - 1]);
}
}
return L[m][n];
}
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
String a = sc.next();
String b = sc.next();
int i = a.length();
int j = b.length();
System.out.println(""+Lcs(a, b, i, j));
}
}
PHYTHON PROGRAM
a=input() b= input() m,n=len(a),len(b) vow="aeiou" DP= [[0 for i in range(n + 1)]for j in range(m + 1)] i, j = 0, 0 for i in range(m + 1): for j in range(n + 1): if (i == 0 or j == 0): DP[i][j] = 0 elif ((a[i - 1] == b[j - 1]) and a[i - 1] in vow): DP[i][j] = DP[i - 1][j - 1] + 1 else: DP[i][j] = max(DP[i - 1][j],DP[i][j - 1]) print(DP[m][n])
Govt Jobs by Qualifications
Education & Vacancies | Salary | Apply Link |
---|---|---|
12th Pass Govt Jobs - 18,000+ Vacancies | Rs. 5,200 - 92,300 | Apply Now |
ITI Pass Jobs - 3,500 Vacancies | Rs. 5,200 - 35,000 | Apply Now |
Any Graduate Jobs - 19,100 Vacancies | Rs. 5,200 - 92,300 | Apply Now |
Central Govt Jobs | Rs. 5,200 - 17,000 | Apply Now |
Bank Jobs - 1,000 Vacancies | Rs. 5,200 - 29,200 | Apply Now |
Diploma Jobs - 9,300 Vacancies | Rs. 5,200 - 35,000 | Apply Now |
BTech/BE Jobs - 18,000 Vacancies | Rs. 15,000 - 1,00,000 | Apply Now |
Data Entry Jobs - 1,300 Vacancies | Rs. 5,200 - 29,200 | Apply Now |
Private Jobs | Rs. 10,000 - 67,700 | Apply Now |