#include<bits/stdc++.h>
using namespace std;
long long m = 100000000000000000;
int minOperations(vector<int> &arr)
{
int n=arr.size();
if(n == 1) return 0;
if(n == 2) return arr[0]+arr[1]<0;
int cnt = 0;
long long prev,curr,next;
prev = m;
curr = arr[0];
next = arr[1];
int ind = 1;
while(ind<n)
{
if(prev+curr+next<0 || curr+next<0)
{
prev = curr;
curr = m;
cnt++;
}else{
prev = curr;
curr = next;
}
if(ind<n) next = arr[ind+1];
ind++;
}
return cnt;
}
UKG โ
Make the Array Positive
def find_consecutive_sets(n):
result = []
count = 0
for i in range(1, n//2 + 2):
sum_ = 0
temp = []
for j in range(i, n + 1):
sum_ += j
temp.append(j)
if sum_ == n:
result.append(temp[:])
count += 1
break
elif sum_ > n:
break
result.reverse()
for seq in result:
print(" ".join(map(str, seq)))
print(count)
n = int(input())
find_consecutive_sets(n)
Deloitte โ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
๐BNP Paribas is hiring for Software Engineer - Java
Experience: 0 - 1 years
Expected Salary: 6-12 LPA
Apply here: https://group.bnpparibas/en/careers/job-offer/software-engineer-java?SRC=LINKEDIN
๐Apna is hiring for Software Engineer
Experience: 0 - 1 years
Expected Salary: 15-30 LPA
Apply here: https://www.linkedin.com/jobs/view/4073181320/?alternateChannel=search
๐EazyDiner is hiring for DevOps Engineer
Experience: 0 - 1 years
Expected Salary: 6-12 LPA
Apply here: https://www.linkedin.com/jobs/view/4074724831/?alternateChannel=search
Experience: 0 - 1 years
Expected Salary: 6-12 LPA
Apply here: https://group.bnpparibas/en/careers/job-offer/software-engineer-java?SRC=LINKEDIN
๐Apna is hiring for Software Engineer
Experience: 0 - 1 years
Expected Salary: 15-30 LPA
Apply here: https://www.linkedin.com/jobs/view/4073181320/?alternateChannel=search
๐EazyDiner is hiring for DevOps Engineer
Experience: 0 - 1 years
Expected Salary: 6-12 LPA
Apply here: https://www.linkedin.com/jobs/view/4074724831/?alternateChannel=search
BNP Paribas
All our job offers ( permanent contract , temporary contract , international volunteer program, internships ...) - BNP Paribas
Discover all our job offers worldwide ( permanent contract , temporary contract , international volunteer program, internships ...) - The bank for a changing world - BNP Paribas
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
๐Motorola Solutions is hiring!
Role: Full Stack Developer
Salary: 7 - 10 LPA (Expected)
Experience: Freshers (0 - 2 Years)
Location: Bangalore, India
๐ปApply: https://motorolasolutions.wd5.myworkdayjobs.com/en-US/Careers/job/Software-Engineer_R46669
Role: Full Stack Developer
Salary: 7 - 10 LPA (Expected)
Experience: Freshers (0 - 2 Years)
Location: Bangalore, India
๐ปApply: https://motorolasolutions.wd5.myworkdayjobs.com/en-US/Careers/job/Software-Engineer_R46669
Myworkdayjobs
MOTOROLA SOLUTIONS OVERVIEW At Motorola Solutions, we believe that everything starts with our people. Weโre a global close-knit community, united by the relentless pursuit to help keep people safer everywhere. Our critical communications, video security andโฆ
#include <bits/stdc++.h>
using namespace std;
long long getMaximumSum(vector<int>& no_adjacent, vector<int>& one_adjacent, vector<int>& both_adjacent) {
int n = no_adjacent.size();
vector<vector<long long>> dp(n, vector<long long>(3, 0));
dp[0][0] = no_adjacent[0];
dp[0][1] = one_adjacent[0];
dp[0][2] = 0;
for (int i = 1; i < n; ++i) {
dp[i][0] = max({dp[i - 1][0], dp[i - 1][1], dp[i - 1][2]}) + no_adjacent[i];
dp[i][1] = max(dp[i - 1][0], dp[i - 1][2]) + one_adjacent[i];
dp[i][2] = dp[i - 1][1] + both_adjacent[i];
}
return max({dp[n - 1][0], dp[n - 1][1], dp[n - 1][2]});
}
Meesho โ
๐1
int beauty( const vector<int> &A )
{
vector<int> B( 1 + A.size(), 0 );
int N = A.size();
for ( int pos = 1; pos <= N; pos++ )
{
auto B_old = B;
int a = A[pos-1]; // index is (position - 1)
for ( int length = 1; length <= pos; length++ )
{
B[length] = max( B_old[length-1] + ( a == length ), B_old[length] );
}
}
return *max_element( B.begin(), B.end() );
}
Meesho โ
{
vector<int> B( 1 + A.size(), 0 );
int N = A.size();
for ( int pos = 1; pos <= N; pos++ )
{
auto B_old = B;
int a = A[pos-1]; // index is (position - 1)
for ( int length = 1; length <= pos; length++ )
{
B[length] = max( B_old[length-1] + ( a == length ), B_old[length] );
}
}
return *max_element( B.begin(), B.end() );
}
Meesho โ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Drop your resume to hr@alwin.io else to the WhatsApp number 6382359432.
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
๐Trainee Cyber Security - Openings: 6
๐ Requirements:
- Fresh B. Tech Graduates with Knowledge of Cyber Security
- Good communication skills
- Willing to Work from Office / Open to Shifts
๐ง Send your CV to Bhawana.Sharma@rsystems.com
๐ Requirements:
- Fresh B. Tech Graduates with Knowledge of Cyber Security
- Good communication skills
- Willing to Work from Office / Open to Shifts
๐ง Send your CV to Bhawana.Sharma@rsystems.com
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Nike is hiring Software Engineer
For 2021, 2022, 2023 gards
Location: Bangalore
https://click.appcast.io/track/l4ior20-org?cs=4c&jg=6uyq&bid=lUf2CslKyPxm6i440ZgUYA==
For 2021, 2022, 2023 gards
Location: Bangalore
https://click.appcast.io/track/l4ior20-org?cs=4c&jg=6uyq&bid=lUf2CslKyPxm6i440ZgUYA==
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
https://forms.office.com/pages/responsepage.aspx?id=vEn-2sNaEEOXtD5Eooy_GOsoJ91ODhZGnZBdY2cdv49UMUVESEZINk1USkVHM1ZXUkFPTFpNSVZNVy4u&route=shorturl
Interested candidate send your resume this mail id
nandini.sharma@exlservice.com
Interested candidate send your resume this mail id
nandini.sharma@exlservice.com
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
TGH Software Hiring Software Developer
Batch : 2020/21/22/23
https://docs.google.com/forms/d/e/1FAIpQLSfrRM3v4YFkLqL4Z_SANg6sdI38AC-tz0D49sTYvD706Q1ubQ/viewform
Batch : 2020/21/22/23
https://docs.google.com/forms/d/e/1FAIpQLSfrRM3v4YFkLqL4Z_SANg6sdI38AC-tz0D49sTYvD706Q1ubQ/viewform
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int[][] tiles = new int[n][n];
for(int i = 0; i < n; i++) {
for(int j = 0; j < n; j++) {
tiles[i][j] = scanner.nextInt();
}
}
System.out.println(solve(n, tiles));
scanner.close();
}
public static int solve(int n, int[][] tiles) {
int[][] dp2 = new int[n][n];
int[][] dp5 = new int[n][n];
int[][] factors2 = new int[n][n];
int[][] factors5 = new int[n][n];
for(int i = 0; i < n; i++) {
for(int j = 0; j < n; j++) {
factors2[i][j] = countFactor(tiles[i][j], 2);
factors5[i][j] = countFactor(tiles[i][j], 5);
}
}
dp2[0][0] = factors2[0][0];
dp5[0][0] = factors5[0][0];
for(int j = 1; j < n; j++) {
dp2[0][j] = dp2[0][j-1] + factors2[0][j];
dp5[0][j] = dp5[0][j-1] + factors5[0][j];
}
for(int i = 1; i < n; i++) {
dp2[i][0] = dp2[i-1][0] + factors2[i][0];
dp5[i][0] = dp5[i-1][0] + factors5[i][0];
}
for(int i = 1; i < n; i++) {
for(int j = 1; j < n; j++) {
dp2[i][j] = Math.min(dp2[i-1][j], dp2[i][j-1]) + factors2[i][j];
dp5[i][j] = Math.min(dp5[i-1][j], dp5[i][j-1]) + factors5[i][j];
}
}
return Math.min(dp2[n-1][n-1], dp5[n-1][n-1]);
}
public static int countFactor(int num, int factor) {
if(num == 0) return Integer.MAX_VALUE;
int count = 0;
while(num % factor == 0) {
count++;
num /= factor;
}
return count;
}
}
Treasure Room โ
Java
โค1๐1
#include <bits/stdc++.h>
using namespace std;
int solve(string s)
{
if (s.empty())
return 0;
int n = s.size();
char lastchar = s[s.size() - 1];
char firstchar = s[0];
vector<int> indexlast;
for (int i = 0; i < n; i++) {
if (s[i] == lastchar)
indexlast.push_back(i);
}
int mini = INT_MAX;
for (int i = 0; i < n; i++) {
if (s[i] == firstchar) {
int index = *lower_bound(indexlast.begin(), indexlast.end(), i);
mini = min(mini, index - i + 1);
}
}
return n - mini;
}
Amazon โ
๐1