Algorithm Enhancement — Summary of LeetCode Weekly Contest 386
Problems
Data Partitioning
Given an integer array nums of even length, split it into two arrays nums1 and nums2, such that:
nums1.length == nums2.length == nums.length / 2
Both nums1 and nums2 contain unique elements.
Return true if the array can be partitioned in this way, otherwise return false.
Approach
Use a hash map to count occurrences ...
Posted on Wed, 21 Oct 2026 16:10:34 +0000 by Viper_4
SMU 2024 Spring Ladder Contest 3 Solutions
7-1 Important Words Repeated Thrice
Print the given phrase three times.
I'm gonna WIN!
I'm gonna WIN!
I'm gonna WIN!
7-2 Learning C in Two Hours
Given total pages n, pages learned per hour k, and hours m, compute remaining pages. The result cannot be negative.
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
int mai ...
Posted on Fri, 09 Oct 2026 16:25:31 +0000 by unxposed
NowCoder Weekly Contest Round 51 Solutions
Problem A: Simple Calculation
Given an integer m, output the ceiling of m/2.
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int64 m;
cin >> m;
cout << (m + 1) / 2 << '\n';
return 0;
}
Problem B: Digit Sum D ...
Posted on Wed, 26 Aug 2026 16:21:38 +0000 by koray
SMU Summer 2023 Contest Round 3 Solutions
A. Curriculum Vitae
The problem requires finding the longest subsequence where digit 1 is never followed by digit 0. This is equivalent to finding the longest non-decreasing subsequence in a binary sequence. An alternative approach uses prefix sums to count zeros and suffix sums to count ones.
#include <bits/stdc++.h>
#define endl '\n'
# ...
Posted on Tue, 30 Jun 2026 18:04:49 +0000 by daz1034
Contest Solutions: Henan Newbie League 2024 Round 5
A – Calendar Game
Ignoring the year, the losing positions follow the pattern (month + day) % 2 == 1, except for the two special dates 9/30 and 11/30 which allow the next player to flip the parity.
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t; cin >> t;
...
Posted on Thu, 07 May 2026 16:47:06 +0000 by stuart7398