vector<int> runningMedian(vector<int> arr) {
priority_queue<int> low;
priority_queue<int, vector<int>, greater<int>> high;
vector<int> res;
for (int num : arr) {
low.push(num);
high.push(low.top());
low.pop();
if (low.size() < high.size()) {
low.push(high.top());
high.pop();
}
res.push_back(low.top());
}
return res;
}
IONโ
priority_queue<int> low;
priority_queue<int, vector<int>, greater<int>> high;
vector<int> res;
for (int num : arr) {
low.push(num);
high.push(low.top());
low.pop();
if (low.size() < high.size()) {
low.push(high.top());
high.pop();
}
res.push_back(low.top());
}
return res;
}
IONโ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Rampwin is hiring for MERN Stack Developer
Experience: 0 - 3 years
Expected Salary: 3-6 LPA
Apply here:
https://www.linkedin.com/jobs/view/3996456915/?alternateChannel=search
Experience: 0 - 3 years
Expected Salary: 3-6 LPA
Apply here:
https://www.linkedin.com/jobs/view/3996456915/?alternateChannel=search
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Infinera is hiring for SW Develop Engr 1- Freshers (2024)
Experience: 0 - 1 years
Expected Salary: 10-20 LPA
Apply here:
https://infinera.wd1.myworkdayjobs.com/Infinera_Careers/job/Bangalore-India/SW-Develop-Engr-1_2024560?jvs=LinkedIn
Experience: 0 - 1 years
Expected Salary: 10-20 LPA
Apply here:
https://infinera.wd1.myworkdayjobs.com/Infinera_Careers/job/Bangalore-India/SW-Develop-Engr-1_2024560?jvs=LinkedIn
Myworkdayjobs
SW Develop Engr 1
About Infinera: Infinera is the global supplier of innovative networking solutions. Our customers include the leading service providers, data center operators, internet content providers (ICPs), cable operators, enterprises, and government agencies worldwideโฆ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
StatusNeo is hiring for Junior Software Engineer
Expected Salary: 6-14 LPA
Apply here: https://www.linkedin.com/jobs/view/3996198805/?alternateChannel=search
Expected Salary: 6-14 LPA
Apply here: https://www.linkedin.com/jobs/view/3996198805/?alternateChannel=search
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Freshers Eligible
Batch: 2022, 2023, 2024
Apply Now
hr@tvminfotech.com
Batch: 2022, 2023, 2024
Apply Now
hr@tvminfotech.com
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
#include <bits/stdc++.h>
using namespace std;
void aa(vector<vector<char>>& board) {
int rows = board.size();
int cols = board[0].size();
for (int i = 0; i < rows; ++i) {
int rightmost = cols - 1;
for (int j = cols - 1; j >= 0; --j) {
if (board[i][j] == '*') {
rightmost = j - 1;
} else if (board[i][j] == '#') {
if (j != rightmost) {
board[i][rightmost] = '#';
board[i][j] = '-';
}
rightmost--;
}
}
}
}
void bb(vector<vector<char>>& board) {
int rows = board.size();
int cols = board[0].size();
for (int j = 0; j < cols; ++j) {
int bottommost = rows - 1;
for (int i = rows - 1; i >= 0; --i) {
if (board[i][j] == '*') {
bottommost = i - 1;
} else if (board[i][j] == '#') {
if (i != bottommost) {
board[bottommost][j] = '#';
board[i][j] = '-';
}
bottommost--;
}
}
}
}
void pushBoxes(vector<vector<char>>& board) {
aa(board);
bb(board);
}
Databrick โ
๐1
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
#include <bits/stdc++.h>
using namespace std;
int solve(long numberToFind) {
if (numberToFind <= 0) {
return 0;
}
int cnt = 0;
bool done = false;
for (int i = 0; i < 33; ++i) {
if (numberToFind < pow(2, i)) {
long result = 0;
long previous = 0;
for (int j = i - 1; j >= 0; --j) {
result = numberToFind - previous - pow(2, j);
if (result == 0) {
cnt++;
done = true;
break;
}
if (result == 1) {
cnt += 2;
done = true;
break;
}
if (result > 0) {
cnt++;
previous += pow(2, j);
}
if (j == 0) {
done = true;
break;
}
}
}
if (done) {
break;
}
}
return cnt % 3;
}
BlackRock โ
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
def findNthDigit(n):
length = 1
while length <= n:
length *= 2
def gd(index, length):
if length == 1:
return '0'
hl = length // 2
if index < hl:
return gd(index, hl)
else:
si = index - hl
bd = gd(si, hl)
if bd == '0':
return '1'
elif bd == '1':
return '2'
else:
return '0'
return int(gd(n, length))
def r():
import sys
i = sys.stdin.read
d = i().strip().split('\n')
s1 = set(d[0].split())
s2 = set(d[1].split())
return s1, s2
def f(s1, s2):
c = s1.intersection(s2)
s_c = sorted(c, key=lambda x: (x.isalpha(), x))
r = ' '.join(s_c)
return r if r else "NULL"
def m():
s1, s2 = r()
print(f(s1, s2))
if name == "main":
m()
BlackRock
Alphanumeric characters โ
import sys
i = sys.stdin.read
d = i().strip().split('\n')
s1 = set(d[0].split())
s2 = set(d[1].split())
return s1, s2
def f(s1, s2):
c = s1.intersection(s2)
s_c = sorted(c, key=lambda x: (x.isalpha(), x))
r = ' '.join(s_c)
return r if r else "NULL"
def m():
s1, s2 = r()
print(f(s1, s2))
if name == "main":
m()
BlackRock
Alphanumeric characters โ
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int T = scanner.nextInt();
while (T-- > 0) {
int N = scanner.nextInt();
int[][] traps = new int[N][N];
int[][] dp = new int[N][N];
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
traps[i][j] = scanner.nextInt();
}
}
for (int j = 0; j < N; j++) {
dp[0][j] = traps[0][j];
}
for (int i = 1; i < N; i++) {
for (int j = 0; j < N; j++) {
int minPath = dp[i - 1][j];
if (j > 0) {
minPath = Math.min(minPath, dp[i - 1][j - 1]);
}
if (j < N - 1) {
minPath = Math.min(minPath, dp[i - 1][j + 1]);
}
dp[i][j] = traps[i][j] + minPath;
}
}
int minSum = dp[N - 1][0];
for (int j = 1; j < N; j++) {
minSum = Math.min(minSum, dp[N - 1][j]);
}
System.out.println(minSum);
}
scanner.close();
}
}
//unify apps treasure hunt
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int T = scanner.nextInt();
while (T-- > 0) {
int N = scanner.nextInt();
int[][] traps = new int[N][N];
int[][] dp = new int[N][N];
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
traps[i][j] = scanner.nextInt();
}
}
for (int j = 0; j < N; j++) {
dp[0][j] = traps[0][j];
}
for (int i = 1; i < N; i++) {
for (int j = 0; j < N; j++) {
int minPath = dp[i - 1][j];
if (j > 0) {
minPath = Math.min(minPath, dp[i - 1][j - 1]);
}
if (j < N - 1) {
minPath = Math.min(minPath, dp[i - 1][j + 1]);
}
dp[i][j] = traps[i][j] + minPath;
}
}
int minSum = dp[N - 1][0];
for (int j = 1; j < N; j++) {
minSum = Math.min(minSum, dp[N - 1][j]);
}
System.out.println(minSum);
}
scanner.close();
}
}
//unify apps treasure hunt
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Company Name: Intract
Roles:
1. Junior Backend Engineer
2. DevOps Engineer
Batch eligible: 2023 and 2024 grads
Apply: https://docs.google.com/forms/d/e/1FAIpQLSf-NtTsThYgZlqP54mkPswy-C--yj1BYgKntgK05PM-cK3uAA/viewform
Roles:
1. Junior Backend Engineer
2. DevOps Engineer
Batch eligible: 2023 and 2024 grads
Apply: https://docs.google.com/forms/d/e/1FAIpQLSf-NtTsThYgZlqP54mkPswy-C--yj1BYgKntgK05PM-cK3uAA/viewform
๐1