WhiteHat Coding
Kanalga Telegram’da o‘tish
Sharing = caring = spreading happiness
Ko'proq ko'rsatish650
Obunachilar
Ma'lumot yo'q24 soatlar
-27 kunlar
-330 kunlar
Postlar arxiv
public static void arrayManipulation(int n, List arr,int q, List> qarr)
{
HashMap mp = new HashMap();
ArrayList ans = new ArrayList();
int flg = 1;
for (int i = 0; i < n; i++)
{
mp.put(arr.get(i), i);
}
for (int i = 0; i < q; i++)
{
List a = qarr.get(i);
if (a.get(0) == 1)
flg *= -1;
else if (a.get(0) == 2)
{
int x = a.get(1);
if (flg == -1)
ans.add(n - mp.get(x) - 1);
else
ans.add(mp.get(x));
}
else
{
int x = a.get(1);
int y = a.get(2);
int x1 = a.get(1);
int y1 = a.get(2);
if (flg == -1)
{
y = n - y - 1;
x = n - x - 1;
}
y = arr.get(y);
x = arr.get(x);
int temp = arr.get(x1);
arr.set(x1, arr.get(y1));
arr.set(y1, temp);
mp.put(x, mp.get(y));
mp.put(y, temp);
}
}
for (int x : ans)
{
if(x==-1) x = 0;
System.out.print(x + " ");
}
}
XOR Subsequences
Python
def bit_count(x):
cnt = 0
while x > 0:
cnt += x & 1
x >>= 1
return cnt
n = int(input())
a = list(map(int, input().split()))
dp = [set() for i in range(n)]
dp[0].add((a[0],))
ans = 0
for i in range(1, n):
dp[i].add((a[i],))
for b in dp[i-1]:
if a[i] > b[-1]:
b2 = b + (a[i],)
dp[i].add(b2)
if len(b) > 1 and bit_count(b[-2] ^ b[-1]) == bit_count(b[-2] ^ a[i]):
b2 = b[:-1] + (a[i],)
dp[i].add(b2)
for b in dp[i]:
x = b[0]
for j in range(1, len(b)):
x ^= b[j]
ans |= x
print(bin(ans).count('1'))
ᴡᴇ ᴅᴏɴ'ᴛ ɴᴇᴇᴅ ᴀɴʏ ᴏᴛʜᴇʀ ᴛʜɪɴɢs ᴊᴜsᴛ ʀᴇᴀᴄᴛ ᴏɴ ᴘᴏsᴛs ᴀɴᴅ ᴍᴀᴋᴇ ᴜs ʜᴀᴘᴘʏ ❤️🤩
Share @whitehatcoding❤️
XOR Subsequences
Python
Trilogy Innovations
def bit_count(x):
cnt = 0
while x > 0:
cnt += x & 1
x >>= 1
return cnt
n = int(input())
a = list(map(int, input().split()))
dp = [set() for i in range(n)]
dp[0].add((a[0],))
ans = 0
for i in range(1, n):
dp[i].add((a[i],))
for b in dp[i-1]:
if a[i] > b[-1]:
b2 = b + (a[i],)
dp[i].add(b2)
if len(b) > 1 and bit_count(b[-2] ^ b[-1]) == bit_count(b[-2] ^ a[i]):
b2 = b[:-1] + (a[i],)
dp[i].add(b2)
for b in dp[i]:
x = b[0]
for j in range(1, len(b)):
x ^= b[j]
ans |= x
print(bin(ans).count('1'))
XOR Subsequences
Python
Trilogy Innovations
Good Arrays Code
int n = arr.size();
int A = arr[0];
int B = arr[n-1];
int k = 0;
for (int i = 1; i < n-1; i++) {
if (arr[i] > A) {
k++;
}
}
long long ways = 1;
for (int i = 1; i <= k; i++) {
ways = (ways * i) % 1000000007;
}
return ways;
#include <bits/stdc++.h>
using namespace std;
int count_ways_to_make_array_good(vector<int>& arr) {
int n = arr.size();
int A = arr[0];
int B = arr[n-1];
int k = 0;
for (int i = 1; i < n-1; i++) {
if (arr[i] > A) {
k++;
}
}
long long ways = 1;
for (int i = 1; i <= k; i++) {
ways = (ways * i) % 1000000007;
}
return ways;
}
int main() {
int n;
cin >> n;
vector<int> arr(n);
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
int ans = count_ways_to_make_array_good(arr);
cout << ans << endl;
return 0;
}
Good array C++✅
Share our channel to ur frd..❤️😁
https://instagram.com/hari__.88?igshid=MTIzZWQxMDU=
My instagram Link👆👆
Please Follow..If u have any doubts..we will discuss..😅😅
Willey edge exam help available at low rates ❤️
Contact: 👉 My friend
@ILOVEU_143✅
Check my previous helps here @Coding_000❤️✅
https://www.hackerearth.com/challenges/new/competitive/amazon-ml-challenge-2023/
Amazon ML Challenge is a two stage competition where students from all engineering campuses across India will get a unique opportunity to work on Amazon’s dataset to bring in fresh ideas and build innovative solutions for a real world problem statement. Top three winning teams will receive cash prizes and certificates.
Registrations will remain open from 3 April 2023 to 20 April 2023 11:59 PM IST. Participation starts from 21 April 2023 12 AM IST to 23 April 2023 11:59 PM IST.
✅ Those who want to clear TCS NQT exam April 14✅👍
Book your slots now
Don't waste your time in wrong attempts and don't miss the opportunity tcs is hiring in mass this time
✅ We will provide all answers -🤝
✅ Contact @ILOVEU_143
✅4k trusted group 🤩🤩
✅💯 clearance and genuine help
✅🔴💯For tcs proofs @Coding_000👨💻
✅✅ Few slots only
Note:- it's paid help
n = int(input())
j=1
print(chr(26-n+97))
for i in range(26-n,25):
print(chr(i+1+97)*j + chr(i+97))
j+=1
Python✅
https://drive.google.com/drive/folders/1h_-oalz4GLywyKURcKm6MV57QE7mJIR9?usp=sharing
Download this in Laptop and save it
You can prepare for all exams with this
It has all exams papers,Resume Templates,Notes,Interview Questions etc
Share it with your Friends
