We could have simply divid N by 2, and if N is odd the Nth element will become the (N/2 +1)th element of the first series. Whereas if N is even, it is the N/2th element of the second series. Which we can easily find out as we know the r for each series. We don't need a loop at all. It's a simple if-else problem
the way you explained is really good.... and so is the logic ... apart from that i just wanna ask..... in place of "if(a==1) condition" , can we go with "if(a>1) {a=a*2}" and intiate a and b equals to 1
He there Vishwas! 🤗 We're always here for you guys ❤️ Feel free to reach out to us over Instagram: www.prepinsta.com/instagram/ Or drop a message on bit.ly/prime-wa Or call us on 8448440710. Our mentors would be very glad to help you out with your queries and placement. Team PrepInsta is always here to help!
JAVA program import java.util.*; public class Main{ public static void main(String[]args){ Scanner sc =new Scanner(System.in); int n=sc.nextInt(); int series1=1; int series2=1; if(n%2==0) { for(int i=1;i
Hey, Join our TA Support Group on Discord, where we will help you out with all your queries: 📍prepinsta.com/discord/ If you are new to discord, please watch our tutorial here❤️: bit.ly/how-to-use-prepinsta-discord-server
#include #include using namespace std; int main() { int n; cin >> n; int term=0; if (n%2!= 0) term = pow(2, (int)(n/2)); term = pow(3, (int)(n / 2 - 1)); cout
ram sunnihith The concept is very well explained in this video infact i have my channel which has similar content.pls check, subscribe and show me your support if u like them and give me u r feedback in comment section.thank you:)
Tanmoy Debnath The concept is very well explained in this video infact i have my channel which has similar content.pls check, subscribe and show me your support if u like them and give me u r feedback in comment section.thank you:)
this can be an easy approach..without taking loops and all.. x = int(input("Enter position:")) y = x/2 if (y).is_integer(): y = y-1; z = 1*pow(3,y); z = int(z); else: a = int(y); z = 1*pow(2,a); z = int(z) print(z)
They will give you an online compiler in the system which will automatically run your code against pre defined inputs. Three inputs will be show and 3 will be hidden
I have one query regarding % i have 7.8in ssc But in diploma i have 59.98% In btech i have 60% so i need to know that iam eligible for TCS or not? Plzzz clear my dought
Sohail, usually TCS asks for 60 % throughout, so if you have less than 60% in any of your academics so it could be a bummer. But don't lose hope, there will be other opportunities as well.
Sir can we compile our program during TCS CCQT exam ? In sample test they are asking to write whole program in one line and compilation option is not there .
import java.util.*; public class findingTerm{ public static void main(String[] args) { int n; Scanner sc = new Scanner(System.in); System.out.println("Enter The Nth term you want to find"); n = sc.nextInt(); double ans=0; if(n%2 != 0) { int power = (n/2)-1+1; ans= Math.pow(2,power); System.out.println(ans); } else{ int power = (n/2)-1; ans=Math.pow(3,power); System.out.println(ans); } } } Simple code that do not use for loop , but it involves so much of maths when you observe the numbers there you can see 1st number is 2^0 next 3^0 .. wa can observe the pattren 2^0,3^0 ,2^1 ,3^1 ,2^2,3^2 .. and so on
Bro as tcs stated 24 months gap is allowed i filled form for nqt and got selection mail on 25 dec. I failed 2 times in second year but i satisfy all other criteria of 60% throughout academics. During interview he asked me about my gap too. So i hope my year down will not create any problem further?
Hey, prepinsta.com/discord Kindly connect with us for technical queries. Our mentor would love to guide you Feel free to reach out to us at 8448440710 if you have any query
Pankaj, why would the students call themselves coder When they already have a name, right Pankaj !?? :) And keep on practising students, it's never too late to start !!
Q:-a man go to the market and buy some product and he find that price of 3 product is bigger than rest of 7 product. For ex- if they shop for 10 items they will give the input as 10 0.2 0.4 0.7 1.31 1.79 1.87 2.13 2.45 2.61 3.11 The output should be printed I single line as 4 Explanation- the 4 costliest items together costed more than all the other items combined. Please send the solution of it in c.
import java.util.Scanner; public class Main { public static void main(String[] args) { int n; Scanner sc = new Scanner (System.in); n = sc.nextInt(); double[] item = new double[n]; double sum = 0,ex=0; for(int i =0;i=0;j--) { ex=ex+item[j]; sum = sum-item[j]; count++; if(ex>sum) break; } System.out.println(count); } }
num = int(input("Enter num ")) array = [] for i in range(1,num+1): if(i % 2 != 0): if(i == 1): a = 1 array.append(a) else: a = a * 2 array.append(a) else: if(i == 2): b = 1 array.append(b) else: b = b * 3 array.append(b) print(array[-1])
Can we use python as coding in digital hiring , but I heared most of them suggested not to use python as it causes compilation prbms , is it true or , I learned only python so pls reaply me frds
CORRECT CODE FOR THE SERIES QUESTION IN JAVA LANGUAGE DOWN: import java.io.*; import java.util.*; import java.lang.*; class tcs4 { public static void main(String args[]) { Scanner sc=new Scanner(System.in); System.out.println("Input the nth term"); int n=sc.nextInt();n=n-2; System.out.print("1 1 ");int t=1;int cc=0;int sum=1; while(t
TCS NQT Online Course - bit.ly/TCS-NQT-and-Ninja-Course
We could have simply divid N by 2, and if N is odd the Nth element will become the (N/2 +1)th element of the first series. Whereas if N is even, it is the N/2th element of the second series. Which we can easily find out as we know the r for each series. We don't need a loop at all. It's a simple if-else problem
These questions are nothing compared to what is asked in Qualcomm preliminary exam 😭😭
I found you at right time now I am knows what to do.
What you will do bhai
@@ganesh7537 haha
the way you explained is really good.... and so is the logic ...
apart from that i just wanna ask.....
in place of "if(a==1) condition" , can we go with "if(a>1) {a=a*2}" and intiate a and b equals to 1
12:23 I can write in single line let me know this is correct or wrong
Read n,
Print("%d",(n%2)?pow(3,n/2):pow(2,n/2));
Clearly understood sir ..the way u explaining it clears all doubts
Thank you for your great explanation sir
He there Vishwas! 🤗
We're always here for you guys ❤️
Feel free to reach out to us over Instagram: www.prepinsta.com/instagram/
Or drop a message on bit.ly/prime-wa
Or call us on 8448440710. Our mentors would be very glad to help you out with your queries and placement.
Team PrepInsta is always here to help!
Thanks prep insta for easy explanation of every problem
Hm
Bro! Clearly understand Thank you so much bro!
JAVA program
import java.util.*;
public class Main{
public static void main(String[]args){
Scanner sc =new Scanner(System.in);
int n=sc.nextInt();
int series1=1;
int series2=1;
if(n%2==0)
{
for(int i=1;i
Hey,
Join our TA Support Group on Discord, where we will help you out with all your queries:
📍prepinsta.com/discord/
If you are new to discord, please watch our tutorial here❤️: bit.ly/how-to-use-prepinsta-discord-server
#include
#include
using namespace std;
int main()
{
int n;
cin >> n;
int term=0;
if (n%2!= 0)
term = pow(2, (int)(n/2));
term = pow(3, (int)(n / 2 - 1));
cout
Kya baat hai sir mja aa gya aapaka. Samjhane ka ktarika...dekh k
Thx..love from Kakinada 😍
:)
We Have just completed with only C & Java how can we write the TCS exam for coding questions. Can You Explain me sir
ram sunnihith The concept is very well explained in this video infact i have my channel which has similar content.pls check, subscribe and show me your support if u like them and give me u r feedback in comment section.thank you:)
bro placement hua kya?
Why dont u make it constant time complexity?
If N is odd:
{
return 2^Floor(N/2);
}
If N is even:
{
Return 3^((N/2)-1);
}
I was thinking the same thing bro.
there's no need of floor function. by default int/int produce result as int, as example 7/2 is 3 by default.
Qs-1
draw pattern
2
4 8
16 32 64
128 256 512 1024
2048 4096 8192 16384 32768
65536 131072 262144 524288 1048576 2097152
public class Main
{
public static void main(String[] args) {
int k=1;
for(int i=1;i
Thank you sir 🙏
In TCS drive if I write the program in java using scanner class will it be ok or I have to use command-line argument? I am confused please help
Tanmoy Debnath The concept is very well explained in this video infact i have my channel which has similar content.pls check, subscribe and show me your support if u like them and give me u r feedback in comment section.thank you:)
what type of coding questions are asked for Soti campus interview
this can be an easy approach..without taking loops and all..
x = int(input("Enter position:"))
y = x/2
if (y).is_integer():
y = y-1;
z = 1*pow(3,y);
z = int(z);
else:
a = int(y);
z = 1*pow(2,a);
z = int(z)
print(z)
In tcs digital should we go for scanf or command line argument fot taking input? Please answer
thanks for providing the solutions!!
Thank you
Does prepinsta have offline classes in pune?
Thanks a lot to understand in easy way..
You can also use formula a^n-1 and b^n-1 inteads of for lopp
Atulya sir you're the best teacher ever !!!!
Do we allowed to import packages in python during the test?
in python we can easily solve the vowel replacing by under 5 lines so does this make any sense in the exam
That's power of python
Can we use append() in tcs online programming exam
Sir, in which programming language the coding would easier Java or Python.
Python
Python
But most of them said don't use python as coding it causes compilation prbms. Is it true frds??
Link in description is not working Y?
can't get the a series from the code above
a series always show's output 0
Jupiter coding Test syllabus and notes about those sir please
This logic click in my mind when u are say in this series two series are mix
Thank u sir
We need to find an output on PC during exam time or we just need to write a code somewhere???
They will give you an online compiler in the system which will automatically run your code against pre defined inputs. Three inputs will be show and 3 will be hidden
is there any course for a company which hires on basis of only exams and does require to have 60% aggregate on 12th standard...
Make a video in sceanrio coding questions
Please upload the videos of amcat and cocubes coding questions
Hi how to prepare amcat and cocubes
do they ask qestions on Dynamic programming , Graph etc
is command line programming needed for tcs?
Yes
@@lakshminarayana7020 no i gave the tcs mock test command line is not needed
Can we use python as coding in tcs Digital
#include
#include
#include
void main()
{
int x,term;
scanf("%d",&term);
if (term%2==0)
x= pow(3,term/2-1);
else
x= pow(2,(term-1)/2);
printf("%d",x);
getch();
}
I have one query regarding % i have 7.8in ssc
But in diploma i have 59.98%
In btech i have 60% so i need to know that iam eligible for TCS or not?
Plzzz clear my dought
Sohail, usually TCS asks for 60 % throughout, so if you have less than 60% in any of your academics so it could be a bummer.
But don't lose hope, there will be other opportunities as well.
Series starting from 0 wt should I do now
What is the difference between B.E computer science engineering and B.E computer science and technology
There is no difference both are same
if you have any questions please ask us in the comment section below -
sir please help me,cognizant campus in my college on 29th of july,first round is debugging test,please help
@@anshuprakash5022 Why don't you join our Cognizant Online Course ??
@@PrepInsta sir I dont think I have much time
is command line programming needed for tcs?
In TCS drive if I write the program in java using scanner class will it be ok or I have to use command-line argument? I am confused please help
Sir can we compile our program during TCS CCQT exam ? In sample test they are asking to write whole program in one line and compilation option is not there .
Excellent😍
Thank you Yasar
JAIHIND SIR KESE HO
import java.util.*;
public class findingTerm{
public static void main(String[] args) {
int n;
Scanner sc = new Scanner(System.in);
System.out.println("Enter The Nth term you want to find");
n = sc.nextInt();
double ans=0;
if(n%2 != 0)
{
int power = (n/2)-1+1;
ans= Math.pow(2,power);
System.out.println(ans);
}
else{
int power = (n/2)-1;
ans=Math.pow(3,power);
System.out.println(ans);
}
}
} Simple code that do not use for loop , but it involves so much of maths when you observe the numbers there you can see 1st number is 2^0 next 3^0 .. wa can observe the pattren 2^0,3^0 ,2^1 ,3^1 ,2^2,3^2 .. and so on
Plz gives more codes for practice
Karna kya hai koi ye bataye N th value nikalna hai ya series create karni hai
can be solved in o(1) time complexity
Yes we can, I don't know y he didn't explain
Yes
which version of python we can use? python 3 or python 2.7
python 3 is best
sir i have done the coding in java but i am getting the whole series. How to get the nth term of the series
You will get the whole series till the position value you have inputed
Sir please explain programs based command line arguments on c
Sir logic bnta nhi h can i write alogorithm on copy then write in code form on computer ? I am very basics learner.
Can we code in python?
Yes @aakash you can code in python surely !
But most of people saaid not to use python as coding in tcs Digital as it causes compilation prbms??? Is it true??
Thank you so much sir love from RJY
I am getting it as site can't be reached now for more codes section
Check now, the site would be reachable now :)
Why couldn't you just use the geometric progression formula
Time complexity kitni horni bhai dekha kya if n= 200 rha to rha to kitna time complexity badenga
where do i get these type of question for placement preparation
Hackerrank
@@pragyapandey8531 thank you for replying
How to take input?
What to do if there is console error?
Thankyou Prep Insta.
Bro as tcs stated 24 months gap is allowed i filled form for nqt and got selection mail on 25 dec.
I failed 2 times in second year but i satisfy all other criteria of 60% throughout academics.
During interview he asked me about my gap too.
So i hope my year down will not create any problem further?
Are you selected
Which language is this
tuzya aaicha dana
Good
Please upload the program in java
How to print whole series
Hey,
prepinsta.com/discord
Kindly connect with us for technical queries. Our mentor would love to guide you
Feel free to reach out to us at 8448440710 if you have any query
Sir can I update my tcs nqt form after 24 July ??
no
In TCS exam how to get a number ... plz help
#include
#include
using namespace std;
int main ()
{
int n;
cout > n;
if (n % 2 == 0)
{
cout
sir I can not printing the whole series...to print this what I have to do?
check the solution here - prepinsta.com/tcs-coding-questions/
My Python Code for the same problem :
for n in range(1, 20):
if n % 2:
print(2 ** (n//2), end=" ")
else:
print(3 ** (n//2 - 1), end=" ")
Hello sir, I want to join your courses for the preparation of placement, how much does I need to pay
Bro I am completing my 2nd year in BTech am I eligible to apply for tcs.
Please respond 🙂
don't call yourself a coder if you can't solve even these below average questions on your own.
Pankaj, why would the students call themselves coder
When they already have a name, right Pankaj !?? :)
And keep on practising students, it's never too late to start !!
@@PrepInsta what's your @, i enjoyed your twitter humor. ; )
can't join whatsapp group,it says group's full
plzz help
We have changed the group link now. Please click again.
Q:-a man go to the market and buy some product and he find that price of 3 product is bigger than rest of 7 product.
For ex- if they shop for 10 items they will give the input as
10
0.2 0.4 0.7 1.31 1.79 1.87 2.13 2.45 2.61 3.11
The output should be printed I single line as
4
Explanation- the 4 costliest items together costed more than all the other items combined.
Please send the solution of it in c.
import java.util.Scanner;
public class Main
{
public static void main(String[] args) {
int n;
Scanner sc = new Scanner (System.in);
n = sc.nextInt();
double[] item = new double[n];
double sum = 0,ex=0;
for(int i =0;i=0;j--)
{
ex=ex+item[j];
sum = sum-item[j];
count++;
if(ex>sum)
break;
}
System.out.println(count);
}
}
correct me if I'm wrong
Can you put the code for python in description box, pls.
num = int(input("Enter num "))
array = []
for i in range(1,num+1):
if(i % 2 != 0):
if(i == 1):
a = 1
array.append(a)
else:
a = a * 2
array.append(a)
else:
if(i == 2):
b = 1
array.append(b)
else:
b = b * 3
array.append(b)
print(array[-1])
Can we use python as coding in digital hiring , but I heared most of them suggested not to use python as it causes compilation prbms , is it true or , I learned only python so pls reaply me frds
(n%2 == 0) ? cout
Heyy... Please tell.. Can a BCA graduate student give tcs exam.... Anyone with the reply.. Please it's an urgency
yes.. you can give the tcs exam..my friend is also BCA graduate and he selected in TCS .
@@omkarshinde7355 thanks for the help
Sir i saw a 2019 que from ur link ..i have a doubt that in c code why u create function that que is also done by without macking function
Is it necessary to create function
@@abhishekgupta9852 Hey, to make the program easy to understand I created a function but you can follow your own version of approach if you'd like :)
Now, I would really appreciate if you provide me the solution for program @ 2:05
You can find it here on this page - prepinsta.com/tcs-coding-questions/
@@PrepInsta Can you provide me the link directly to that solution.
It would really help me a lot.
Thanks.
Bt he question to nhi aaye the
Plzzz many companies question tell
👍
I am getting it as site can't be reached now
Hey, We think that the issue must have been fixed please check !
CORRECT CODE FOR THE SERIES QUESTION IN JAVA LANGUAGE DOWN:
import java.io.*;
import java.util.*;
import java.lang.*;
class tcs4
{
public static void main(String args[])
{ Scanner sc=new Scanner(System.in);
System.out.println("Input the nth term");
int n=sc.nextInt();n=n-2;
System.out.print("1 1 ");int t=1;int cc=0;int sum=1;
while(t
if n=1 then what will be the output?
Good