TCS NQT 2024 Preparation | Coding Question Discussion | TCS NQT Coding Preparation | Ques - 1

  Рет қаралды 60,527

Code Bashers

Code Bashers

Күн бұрын

Пікірлер: 47
@heymister7510
@heymister7510 8 ай бұрын
import math def isprime(n): c=0 for i in range(2,n): if n%i==0: c+=1 if c==0: return True else: return False def isperfect(n): if n**0.5==int(n**0.5): return True else: return False def out(n): if n==0: print(1) l=[] m=[] for i in range(2,n+1): if isprime(i): l.append(i) for i in range(1,n+1): if isperfect(i): m.append(i) if isprime(n): r=l.index(n) res=int(math.pow(2,r)) return res elif isperfect(n): r=m.index(n) res=int(math.pow(3,r)) return res else: c=out(n-1)+out(n-2) return int(c) n=int(input()) print(out(n))
@sankalpnaik877
@sankalpnaik877 8 ай бұрын
Your "smartwork" will take more time than writing logic
@flash_ae
@flash_ae 9 ай бұрын
package TCS; public class Question1 { private static boolean isPrime(int i) { if(i
@ranadheerpenki9919
@ranadheerpenki9919 6 ай бұрын
🎯 Key points for quick navigation: 01:14 *🧩 Understanding the series pattern with prime and square positions.* 02:51 *📊 Explaining how to derive the series based on prime, square, and other positions.* 07:22 *💡 Approach to solving the coding question by iterating through the series positions.* 11:49 *🖥️ Code walkthrough for implementing the logic of identifying prime numbers, perfect squares, and sum of previous two values.* 17:51 *🔄 Ensuring correct output by adjusting array indexing based on positions in the series.* Made with HARPA AI
@yashdarole7792
@yashdarole7792 8 ай бұрын
in java import java.util.*; public class equiindex{ private static HashSet primes = new HashSet(Arrays.asList(2,3,5,7,11,13,17,19,23,29,31,37)); public static Boolean isPrime(int n){ return primes.contains(n); } private static HashSet square = new HashSet(Arrays.asList(1,4,9,16,25,36)); public static Boolean isSquare(int n){ return square.contains(n); } public static void Series(int n ){ int pop=1; int pos=1; int arr[] = new int [n]; for(int i=0;i
@maheenfatma4694
@maheenfatma4694 3 ай бұрын
Are these actual TCS questions??
@ArnabBhadra02
@ArnabBhadra02 Жыл бұрын
This kind of question is foundation level qs or advance level And one more thing in the advance section the both coding will be tough or one will be easy
@CodeBashers
@CodeBashers Жыл бұрын
One will be easy and second will be difficult
@vishurathore1676
@vishurathore1676 9 ай бұрын
public static boolean isPrime(int n){ for(int i =2 ; i
@shadowfrank1731
@shadowfrank1731 5 ай бұрын
U didn't input the nth term? How will u get the answer
@giveawayfinder_Roni
@giveawayfinder_Roni 9 ай бұрын
thanks sir previous yr qst solve kariye plz.
@abhishekkumarsingh611
@abhishekkumarsingh611 Жыл бұрын
39 is not prime you have put true
@abhishekanand3462
@abhishekanand3462 4 ай бұрын
Jo 2 Coding Questions ke liye 90 Min milte hai ,usme humlog kabhi bhi unn 2 Questions ke beech switch kar sakte hai ki ?? Har 1 Coding Question ka time slot fixed hota hai aur agar fixed hota hai to 1st quesn ko kitna time milta hai ??
@mechscitech6227
@mechscitech6227 4 ай бұрын
fixed hota hai dono question ka time slot
@abhishekanand3462
@abhishekanand3462 4 ай бұрын
@@mechscitech6227 Aur , kya 10 hi Compilations milte hai ek Question ke liye ?
@abhishekanand3462
@abhishekanand3462 4 ай бұрын
@@mechscitech6227 kya humlog #include ka use kar sakte hai TCS ke exam me
@Tanmoy-d4h
@Tanmoy-d4h 3 ай бұрын
@@abhishekanand3462 nhi
@trusfratedbunny2215
@trusfratedbunny2215 2 ай бұрын
@@abhishekanand3462 Bro can u plz tell what this header do..?
@saiavinash663
@saiavinash663 Ай бұрын
how to write code in python
@sagarsinha668
@sagarsinha668 4 ай бұрын
jise coding ka c nhi ata wo kese kre....kese kia or kese padhe ki yh chije samjh ay
@amitkr3641
@amitkr3641 8 ай бұрын
Can you tell me one thing that NQT exam will be MCQ based or not ?
@imvishal_kr
@imvishal_kr 8 ай бұрын
All sections will be MCQ, except coding part
@AmberSparrow876
@AmberSparrow876 Жыл бұрын
Is this an easy-level question?
@TheRewindRoom
@TheRewindRoom 8 ай бұрын
Medium level
@servingcynical9822
@servingcynical9822 Жыл бұрын
Provide me in Java
@arun5536
@arun5536 7 ай бұрын
Python programming
@preetamkumar8128
@preetamkumar8128 5 ай бұрын
Can you give me this coding question as java i can't understand python
@CodeBashers
@CodeBashers 5 ай бұрын
Hi contact me at t.me/cdb15
@terranceraj6834
@terranceraj6834 8 ай бұрын
i had to write this particular piece of code for it to understand the last else condition cuz the array was going out of bounds if (n >= 1) { arr[0] = 1; } if (n >= 2) { arr[1] = 1; } can we do this in some alternate way
@AlgorithmCodings
@AlgorithmCodings 5 ай бұрын
package java_pratice; import java.util.*; public class hello { public static void main(String[] args){ Scanner in = new Scanner(System.in); int term = in.nextInt(); int power_of_2 =1; int power_of_3 =1; int[] arr =new int[term]; for(int i=0;i
@trusfratedbunny2215
@trusfratedbunny2215 2 ай бұрын
What to do, Values at remaining position is not coming When enter that element like values at position 6, 8, 10, 12, 14, 15
@Czjajava
@Czjajava 8 ай бұрын
16 is a power of 3 ?????
@Standboard
@Standboard 8 ай бұрын
16 is a perfect sqaure of 4 which you have to replace with a power of 3
@Ravi_Raj_._09-v5w
@Ravi_Raj_._09-v5w 8 ай бұрын
39 is not a prime number
@harshprajapat165
@harshprajapat165 6 ай бұрын
It is prime bro
@prabhakarsinghbaghel3904
@prabhakarsinghbaghel3904 5 ай бұрын
​@@harshprajapat165 13x3=39 how is it prime dude, basic maths 3+9=12 which means its divisible by 3 as 12 is divisible by 3
@03_utpallucky40
@03_utpallucky40 6 ай бұрын
#include #include using namespace std; bool isPrime(int n){ for(int m=2;m
@nagalavanyadoradla6076
@nagalavanyadoradla6076 11 ай бұрын
Can You please check whether this code works properly for all test cases def powerOf(a,b): if(b==0): return 1 else: return a*powerOf(a,b-1) def prime(n): c=0 for i in range(2,n): if(n%i==0): c=c+1 break if(c==1): return False else: return True def perfect(n): if(n**0.5==int(n**0.5)): return True else: return False def count(n): if(n==0 or n==1): print(1) l=[] l1=[] for i in range(2,n+1): if(prime(i)): l.append(i) for i in range(2,n+1): if(perfect(i)): l1.append(i) if(prime(n)): r=l.index(n) ans=powerOf(2,r) return ans elif(perfect(n)): r2=l1.index(n)+1 ans2=powerOf(3,r2) return ans2 else: return count(n-1)+count(n-2) n=int(input()) print(count(n))
@AJayasri-p3x
@AJayasri-p3x Ай бұрын
How to contact you.
@CodeBashers
@CodeBashers Ай бұрын
Contact me at t.me/cdb15
@dharanirama4914
@dharanirama4914 8 ай бұрын
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc= new Scanner(System.in); int n=sc.nextInt(); int pos=1; int pos1=1; int a[]=new int[41]; for(int i=1;i
@shashwat4299
@shashwat4299 6 ай бұрын
39 is not a prime no
@CodeBashers
@CodeBashers 6 ай бұрын
Can u contact me at t.me/cdb15
@ankitabanerjee4958
@ankitabanerjee4958 4 ай бұрын
39 is not a prime number
@piyush.creates
@piyush.creates 2 ай бұрын
39 is not a prime number
Thank you mommy 😊💝 #shorts
0:24
5-Minute Crafts HOUSE
Рет қаралды 33 МЛН
Who is More Stupid? #tiktok #sigmagirl #funny
0:27
CRAZY GREAPA
Рет қаралды 10 МЛН
I made Tetris in C, this is what I learned
15:15
Austin Larsen
Рет қаралды 23 М.
ASMR Programming - Spinning Cube - No Talking
20:45
Servet Gulnaroglu
Рет қаралды 4,3 МЛН
I Solved 100 LeetCode Problems
13:11
Green Code
Рет қаралды 301 М.
Thank you mommy 😊💝 #shorts
0:24
5-Minute Crafts HOUSE
Рет қаралды 33 МЛН