public class Q29_1 {
static void printAllSubsets(int[] A, int K) {
int N = A.length;
for (int i = 0; i < (1 << N); i++) {
int sum = 0;
for (int j = 0; j < N; j++) {
if ((i & (1 << j)) > 0)
sum += A[j];
}
if (sum == K) {
for (int j = 0; j < N; j++) {
if ((i & (1 << j)) > 0)
System.out.print(A[j] + " ");
}
System.out.println();
}
}
}
public static void main(String[] args) {
int[] A = {0, 1, 2, 3, 5, 6, 7, 11, 12, 14, 20};
int K = 7;
printAllSubsets(A, K);
}
}
static void printAllSubsets(int[] A, int K) {
int N = A.length;
for (int i = 0; i < (1 << N); i++) {
int sum = 0;
for (int j = 0; j < N; j++) {
if ((i & (1 << j)) > 0)
sum += A[j];
}
if (sum == K) {
for (int j = 0; j < N; j++) {
if ((i & (1 << j)) > 0)
System.out.print(A[j] + " ");
}
System.out.println();
}
}
}
public static void main(String[] args) {
int[] A = {0, 1, 2, 3, 5, 6, 7, 11, 12, 14, 20};
int K = 7;
printAllSubsets(A, K);
}
}
Java Hyd Team
What is the solution of this question
package com.Aman;
public class Q27_1 {
static int maxConsecutiveOnes(int x)
{
int count = 0;
while (x!=0)
{
x = (x & (x << 1));
count++;
}
return count;
}
public static void main(String args[])
{
int x = 1000;
System.out.println(maxConsecutiveOnes(x));
}
}
public class Q27_1 {
static int maxConsecutiveOnes(int x)
{
int count = 0;
while (x!=0)
{
x = (x & (x << 1));
count++;
}
return count;
}
public static void main(String args[])
{
int x = 1000;
System.out.println(maxConsecutiveOnes(x));
}
}
Microsoft is hiring for Research Intern
Role: Research Intern
Passout year: 2023/2024/2025
Qualification: BE/B.Tech/ME/M.Tech/MCA/MSC
Salary: 60k - 70k per month
Location: Benguluru
Apply Now: https://careers.microsoft.com/us/en/job/1491041/
Role: Research Intern
Passout year: 2023/2024/2025
Qualification: BE/B.Tech/ME/M.Tech/MCA/MSC
Salary: 60k - 70k per month
Location: Benguluru
Apply Now: https://careers.microsoft.com/us/en/job/1491041/
When I sat down for my Amazon interview, I thought -
First round hai kya hi puch lenge πββοΈπ
They asked ππππ + ππππ€ππ«πππ€π’π§π + πππ¦π¨π’π³πππ’π¨π§ Que ππ£
Socha kuch or ππ‘πππππ₯, nikla kuch or π₯
Prepare well and don't assume they will ask easy questions.
#meme #amazon #coding #dsa #maang #interview #programming
First round hai kya hi puch lenge πββοΈπ
They asked ππππ + ππππ€ππ«πππ€π’π§π + πππ¦π¨π’π³πππ’π¨π§ Que ππ£
Socha kuch or ππ‘πππππ₯, nikla kuch or π₯
Prepare well and don't assume they will ask easy questions.
#meme #amazon #coding #dsa #maang #interview #programming