TCS Interview | Java Coding Interview Question Answers

preview_player
Показать описание
In this video, we solved Java Coding Interview Question which was asked in TCS Interview. The candidate had 3 Years of Experience working as a Java Developer, He solved the problem and got selected with CTC of 9.7 LPA.

#leetcode
#java
#interview
#javaprogramming
#javacoding
#javainterviewquestions
#TCSInterviewQuestions
Рекомендации по теме
Комментарии
Автор

Hi I am a beginner in java
So my code
Not exactly the expected O/p but a similar Output
import java.util.*;
Class Grp
{
P. S. V. main(String args[])
{
String str="I love your cats and dog";
String arr[]= str. split(" ") ;
HashSet<Integer>set=new HashSet<>() ;
for(int i=0 ; i<arr.length ; i++)
{
set. add(arr[ i ].length()) ;
}
for( int n : set)
{
Sys. Out(n+" Letter elements are : ") ;
for(int i=0 ; i < arr.Length ; i++)
{
if( arr[ i ] . length( )==n)
{
Sys. Out( arr[ i ] ) ;
} } } } }

O/p
1 letter elements are:
I
3 letter elements are:
dog
and
4 letter elements are:
love
your
cats

I think I am not a beginner but more than that

parthivparthu
Автор

Can we do it this way?;

Iterate over the given string list and take every word at ith index and extract it's length and check if that length exists in map or not. If not, put the length as key and word as value and if already exists, just put the word corresponding to the existing value.

lonestoryteller
Автор

As you said static is used so that JVM does not need to create the Object of the Class. Isn't JVM capable of creating objects?

supergamefreak
Автор

Can you please add more company based questions, including theory and code both

prashantrana
Автор

Hi, can u write the program in string array 1st character match with other string then group it and count the string. i faced this question in interview

hanumantharaojangala
Автор

I think this is not interview questions asked by company
These are asked to freshers and he is saying 3yre experience

debiprasaddash