๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
string makeLexicographicallySmallestPalindrome(string s) {
int n=s.length();
unordered_map<char, int> cnt;
string R = "";
for (int i = 0; i < n; i++) {
char a = s[i];
cnt[a]++;
}
for (char i = 'a'; i <= 'z'; i++) {
if (cnt[i] % 2 != 0)
R += i;
}
int l = R.length();
int j = 0;
for (int i = l - 1; i >= l / 2; i--) {
cnt[R[i]]--;
R[i] = R[j];
cnt[R[j]]++;
j++;
}
string first, middle, second;
for (char i = 'a'; i <= 'z'; i++) {
if (cnt[i] != 0) {
if (cnt[i] % 2 == 0) {
int j = 0;
while (j < cnt[i] / 2) {
first += i;
j++;
}
} else {
int j = 0;
while (j < (cnt[i] - 1) / 2) {
first += i;
j++;
}
middle += i;
}
}
}
second = first;
reverse(second.begin(), second.end());
string resultant = first + middle + second;
return resultant;
}
Palindromic Algorithm โ
๐ฅ2๐1
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
#include <bits/stdc++.h>
using namespace std;
class Directory {
public:
unordered_map<string, unordered_set<string>> children;
Directory(vector<vector<string>>& edges) {
for (auto& edge : edges) {
children[edge[0]].insert(edge[1]);
}
}
void mkdir(string parent, string folder) {
children[parent].insert(folder);
}
void rmdir(string folder) {
children.erase(folder);
for (auto& pair : children) {
pair.second.erase(folder);
}
}
int countSubdir(string folder) {
int count = 1;
for (auto& child : children[folder]) {
count += countSubdir(child);
}
return count;
}
};
vector<int> getSubFolders(vector<vector<string>>& existingStructureEdges, vector<string>& queries) {
Directory dir(existingStructureEdges);
vector<int> results;
for (string& query : queries) {
stringstream ss(query);
string operation, x, y;
ss >> operation;
if (operation == "mkdir") {
ss >> x >> y;
dir.mkdir(x, y);
} else if (operation == "rmdir") {
ss >> x;
dir.rmdir(x);
} else if (operation == "count_subdir") {
ss >> x;
results.push_back(dir.countSubdir(x));
}
}
return results;
}
File Structure โ
โค1๐ฅ1
Solve the Equation โ
Special String โ
int min(string str){
unordered_map<char,int>mp;
for(char :str){
mp[ch]++;
}
unodered_set<int>d;
for(auto it:mp){
d.insert(it.second);
}
return d.size();
}
Music Teacher โ
Only 4 test cases pass
unordered_map<char,int>mp;
for(char :str){
mp[ch]++;
}
unodered_set<int>d;
for(auto it:mp){
d.insert(it.second);
}
return d.size();
}
Music Teacher โ
Only 4 test cases pass
Valid permutations โ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Manish:
Company Name : Freshworks INC
Role : 1. Application Developer
2. Software Developer
Package Freshers: 5LPA
Package Experience (1-2 yrs) : 7.5 LPA
Skills Needed : Java , Python , HTML, CSS, Java Script, SQL and DBMS.
Location: Bangalore and Chennai (currently remote)
Passed out : 2021 - 2025
Round 1 : Coding Assessment Live in Google meet with interviewer (30 mins)
Round 2 : Technical Interview (30 mins)
Round 3 : HR Interview (20 mins)
https://docs.google.com/forms/d/e/1FAIpQLScSh9qPFBce3XvlCUbm4ZpIKuqTcN6IIsdTLPh2WXhAC4XRfQ/viewform?usp=sf_link
Company Name : Freshworks INC
Role : 1. Application Developer
2. Software Developer
Package Freshers: 5LPA
Package Experience (1-2 yrs) : 7.5 LPA
Skills Needed : Java , Python , HTML, CSS, Java Script, SQL and DBMS.
Location: Bangalore and Chennai (currently remote)
Passed out : 2021 - 2025
Round 1 : Coding Assessment Live in Google meet with interviewer (30 mins)
Round 2 : Technical Interview (30 mins)
Round 3 : HR Interview (20 mins)
https://docs.google.com/forms/d/e/1FAIpQLScSh9qPFBce3XvlCUbm4ZpIKuqTcN6IIsdTLPh2WXhAC4XRfQ/viewform?usp=sf_link
URL Hashing โ
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
int solve(int n, vector<int>& arr) { while (arr.size() > 1) { int len = INT_MAX; int idx = -1; for (int i = 0; i < arr.size() - 1; ++i) { int d = arr[i + 1]; if (d == 0 || arr[i] == 0) { continue;โฆ
Women Day Mathematics Challenge
C++โ
C++โ
Income Analysis โ