CP Week 1
Day 1 – Basics: Input, Output, If-Else, Loops
📘 Focus Topic: Syntax, loops, if-else
✅ Day 2 – Basic Math & Brute Force
📘 Focus Topic: Modulo, math, loops
✅ Day 3 – Arrays: Traversal & Counting
📘 Focus Topic: Array operations, min/max
✅ Day 4 – Strings: Manipulation & Counting
📘 Focus Topic: Strings, case conversion, frequency
| Task | How to solve |
|---|---|
| Is string a palindrome? | Compare front and back chars using 2-pointer |
| Anagram check? | Compare character frequency arrays |
| Count vowels/digits/specials | `if (ch == 'a' |
| Case-insensitive comparison | Convert both strings to same case first |
| Remove duplicates | Use boolean array or frequency array |
✅ Day 5 – Sorting & Greedy Basics
🔍 Core Basics of Sorting Problems
1. ✅ Sort Numbers
Concept: Just sort numbers in ascending or descending order.
Skills: Use built-in sorting (qsort() in C) or manually sort.
📌 Example:
Input:
3 1 2→ Output:1 2 3
🧪 Practice:
2. 🧠 Sort Strings
Concept: Sort strings alphabetically or by length.
📌 Example:
Input:
bat,apple,car→ After sort:apple bat car
🧪 Practice:
3. 📦 Sort with Original Index
Concept: Keep track of original position after sorting.
Technique: Use a struct or two arrays — one for value, one for original index.
🧪 Practice:
4. 🎯 Sort Then Greedy Selection
Concept: After sorting, make the best decision step-by-step.
📌 Example:
Pick smallest tasks first, or minimize cost.
🧪 Practice:
5. 📊 Sort + Frequency
Concept: Sort array and count how many times each number appears.
📌 Example:
Check if any number occurs more than once after sorting.
🧪 Practice:
6. 🔁 Two Pointers after Sort
Concept: After sorting, use two pointers from left and right to pair elements.
🧪 Practice:
✅ Daily Practice Plan (Beginner Sorting)
Try to solve 2 problems/day for the next few days:
Day 1:
Day 2:
Day 3:
📘 Focus Topic: Sorting for simplification
-
[281A – Word Capitalization](repeat for review)
-
[112A – Petya and Strings](repeat for mastery)
✅ Day 6 – Review + Missed Problems
📘 Focus: Re-solve or finish any from earlier days
-
Pick 4 problems you failed or skipped.
-
Solve 3 new problems in your comfort range:
-
[339A – Helpful Maths](again for sorting)
-
[546A – Soldier and Bananas](easy math)
-
[1A – Theatre Square](geometry basics)
-
✅ Day 7 – Simulated Contest Day
📘 Focus: Build contest skill under pressure
Solve these 7 problems in one sitting (90–120 mins):
-
[158A – Next Round](math + condition)
-
[282A – Bit++](easy loop)
-
[69A – Young Physicist](array + logic)
-
[236A – Boy or Girl](string frequency)
Gellyfish and Baby's Breath
Comments
Post a Comment