Skip to content

Instantly share code, notes, and snippets.

View nags0x's full-sized avatar
💭
box box

Nags nags0x

💭
box box
View GitHub Profile
@nags0x
nags0x / gist:f5733b08d8890acb26a251c9ff091d1a
Created June 11, 2025 14:32
#3445 -- need to fix tle
class Solution {
public:
int maxDifference(string s, int k) {
int maxDiff = INT_MIN;
int n = s.size();
for (int win = k; win <= n; ++win) {
unordered_map<char, int> freq;
for (int i = 0; i < win; ++i) {
#include <iostream>
#include <unordered_map>
#include <climits>
#include <string>
using namespace std;
int maxDiffEvenOddFreq(const string& s) {
unordered_map<char, int> freq;
// Count frequency of each character
class Solution {
public:
int findKthNumber(int n, int k) {
long long node = 1;
for (int i = 1; i <= k; i++) {
if (i == k) {
return node;
}
if (node * 10 <= n) {