var stdin process.openStdin();
stdin.addListener("data", function(d) {
// note: d is an object, and when converted to a string it will
// end with a linefeed. so we (rather crudely) account for that
// with toString() and then trim()
console.log(d.toString().trim());
});
Driver Code โ
let fs = require("fs");
function longestSubstringTwoDistinct(s) {
let maxLen = 0;
let startIndex = 0;
let charIndexMap = new Map();
for (let i = 0; i < s.length; i++) {
charIndexMap.set(s[i], i);
if (charIndexMap.size > 2) {
let minIndex = Math.min(...charIndexMap.values());
charIndexMap.delete(s[minIndex]);
startIndex = minIndex + 1;
}
maxLen = Math.max(maxLen, i - startIndex + 1);
}
return maxLen;
}
function Main(arg) {
let inputString = String(arg);
return longestSubstringTwoDistinct(inputString);
}
Valid Paris
Victoria Secret โ
Victoria Secret โ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Linkedin
Wassem Mohd on LinkedIn: #malaysia #internship #malaysia #software | 10 comments
EasyEat is hiring technology interns in #Malaysia
We are looking for three interns with a strong academic background with a degree in computer science orโฆ | 10 comments on LinkedIn
We are looking for three interns with a strong academic background with a degree in computer science orโฆ | 10 comments on LinkedIn
#include<bits/stdc++.h>
using namespace std;
vector<int> getExecTime(int n, vector<string> logs) {
vector<int> res(n, 0);
stack<int> st;
int prev = 0;
for(string log : logs) {
stringstream ss(log);
string buf;
getline(ss, buf, ':');
int id = stoi(buf);
getline(ss, buf, ':');
string type = buf;
getline(ss, buf, ':');
int time = stoi(buf);
if(!st.empty()) {
res[st.top()] += time - prev;
}
prev = time;
if(type == "start") {
st.push(id);
} else {
res[st.top()]++;
st.pop();
prev++;
}
}
return res;
}
IBMโ
using namespace std;
vector<int> getExecTime(int n, vector<string> logs) {
vector<int> res(n, 0);
stack<int> st;
int prev = 0;
for(string log : logs) {
stringstream ss(log);
string buf;
getline(ss, buf, ':');
int id = stoi(buf);
getline(ss, buf, ':');
string type = buf;
getline(ss, buf, ':');
int time = stoi(buf);
if(!st.empty()) {
res[st.top()] += time - prev;
}
prev = time;
if(type == "start") {
st.push(id);
} else {
res[st.top()]++;
st.pop();
prev++;
}
}
return res;
}
IBMโ
Maximum quirknessโ
ll ans=LLONG_MIN;
i=0;
ll sum=0;
set<ll> s;
while(i<n)
{
if(i)
ans=max(ans,sum+a[i]+c*i-*s.begin());
s.insert(sum+c*i);
sum+=a[i];
i++;
}
cout ยซ ans ยซ "\n";
ll ans=LLONG_MIN;
i=0;
ll sum=0;
set<ll> s;
while(i<n)
{
if(i)
ans=max(ans,sum+a[i]+c*i-*s.begin());
s.insert(sum+c*i);
sum+=a[i];
i++;
}
cout ยซ ans ยซ "\n";
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Maximum quirknessโ
ll ans=LLONG_MIN; i=0; ll sum=0; set<ll> s; while(i<n) { if(i) ans=max(ans,sum+a[i]+c*i-*s.begin()); s.insert(sum+c*i); sum+=a[i]; i++; } cout ยซ ans ยซ "\n";
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Linkedin
Neelabhra B. on LinkedIn: #laidoff #market #hiring #jobs #hyland #laidoff #openpositions #hiringโฆ | 12 comments
Update: Referred and replied to most of the applicants. Closing further referrals for now.
Happy Holidays, everyone!
While some of us are enjoying, thereโฆ | 12 comments on LinkedIn
Happy Holidays, everyone!
While some of us are enjoying, thereโฆ | 12 comments on LinkedIn
๐3
String Generation โ