Skip to main content

C++ Day 39

  C++ Day 39 STL Containers (Deep Understanding & Real Usage) Till now, you already know arrays, vectors, loops, and STL algorithms. Today, we go one step deeper and understand STL containers , which are the backbone of modern C++ programming. In real projects and competitive coding, choice of container matters a lot. 1. What are STL Containers? STL containers are data structures provided by C++ to store data efficiently. They handle: memory management resizing element access performance optimization You focus on logic , not memory handling. 2. Categories of STL Containers STL containers are mainly divided into: Sequence Containers Associative Containers Unordered Containers Container Adapters 3. Sequence Containers These store data in sequence . 3.1 Vector Most used container in C++. vector< int > v; Key Features: Dynamic size Contiguous memory Fast random access Slower insertion in middle Example: v. push_...

Dream

 

DREAM

Everyone has a goal—something deep within that pushes us ahead and gives significance to our route in life. If we are ready to battle for them, dreams are powerful visions that may determine our future; they are not just fantasies or hopes we develop during free time. Every dream differs. Some could want to be doctors and assist the sick. Some may aspire to be a writer, a teacher, an athlete, even a scientist who publishes a revolutionary discovery. Whatever the goal is, the road to achieve it always has one big feature: industrious labor.


Education enables us to chase our objectives in contemporary life. It is quite very crucial. It underpins the construction of our tomorrow. Encouragement to read, write, think critically, and solve problems starts early on. Rather than only scholastic exercises, these are tools that help us to meet our goals and unleash our potential. Studying is not always easy; it demands concentration, patience, and the ability to keep going even when weary or defeated. Those who constantly study with a particular goal, though, find themselves heading toward the dream they formerly only imagined.


Still, education by itself falls short. Will is also crucial. Sometimes we will fall short of expectations, fail an exam, or run into problems that make us doubt our ability. Willpower comes into play here. Will is by definition growing every time we trip. It is practicing while others are resting, studying when others are sleeping, and believing in ourselves when no one else does. Though one's path to achieving a goal is strewn with challenges, motivated people view those obstacles as opportunities for personal growth.


Dreams also take time to manifest, so it would be wise to keep this in mind. They need time, labor, and often much of sacrifice. There could come days when you feel like giving up, the volume of studies is too much, or events don't turn out as expected. Those who remain steadfast in their efforts and keep going, however, ultimately prevail. Every little committed step we take brings us closer to our desired destination, even if the journey may be lengthy.


Dreams are also about transforming the world, not just personal accomplishment. One day someone who works very hard to be a teacher could motivate hundreds of children. A student aspiring to be a physician could save lives one day. When a child seeking to become an entrepreneur realizes his dreams, he might create jobs and support the economy to grow. Dreams affect many others beyond the life of the dreamer.


Everyone eventually has a dream, and education, work, and relentless will could help every dream come true. With self-belief and readiness to work, one can achieve any goal, little or large. So, keep growing, always dream, and keep studying. One day your dream will become your reality, not just a dream, when all that labor pays off.

Comments

Popular posts from this blog

C++ Day 35

  C++ Day 34: Layout Layouts (Part 2) We’ll cover: Constructer Layout Adjuster Layout Decorator Layout practise Task 🔹 1. developer form (creational) used to make compound objects measure away step ✅ employ case: you need to form associate in nursing aim (like amp pizza pie calculator house) with elective parameters example: cpp copy edit class calculator {     train Methodor gpu ram; public:     family developer {         train Methodor gpu ram;     public:         developer setcpu(string c) { Methodor = c; take *this; }         developer setgpu(string g) { gpu = g; take *this; }         developer setram(string r) { run = r; take *this; }         calculator Construct() {             take Calculater(cpu gpu ram);         }     };     Calculater(string snow train m train r) : cpu(c) gp...

C++ Day 33

  C++ Day 33: Smart Pointers & Memory Management 🔹 1. wherefore forward pointers in c++ hand-operated green / cancel is error-prone: memory leaks 🧠 double deletes ❌ dangling pointers 💥 smart pointers care store mechanically exploitation raii (Supply skill is initialization) 🔹 ii. Types of Smart Pointers in C++ ✅ std::unique_ptr Sole ownership of a Supply. Cannot be copied. Automatically deletes the Supply when it goes out of scope. cpp Copy Edit #include  unique_ptr ptr1 = make_unique(10); cout << *ptr1 << endl; // 10 You can transfer ownership: cpp Copy Edit unique_ptr ptr2 = move(ptr1); ✅ std::shared_ptr Shared ownership multiple shared_ptrs can point to the same object. Uses reference counting to track how many owners. cpp Copy Edit shared_ptr p1 = make_shared(100); shared_ptr p2 = p1;  // Reference count = 2 When count goes to 0 memory is released. ✅ std::weak_ptr Non-owning reference to a shared_ptr-managed object. Used to break cyclic references ...

CSES Increasing Subsequence solution

 You are given an array containing  n n n integers. Your task is to determine the longest increasing subsequence in the array, i.e., the longest subsequence where every element is larger than the previous one. A subsequence is a sequence that can be derived from the array by deleting some elements without changing the order of the remaining elements. Input The first line contains an integer n n n : the size of the array. After this there are n n n integers x 1 , x 2 , … , x n x_1,x_2,\ldots,x_n x 1 ​ , x 2 ​ , … , x n ​ : the contents of the array. Output Print the length of the longest increasing subsequence. Constraints 1 ≤ n ≤ 2 ⋅ 1 0 5 1 \le n \le 2 \cdot 10^5 1 ≤ n ≤ 2 ⋅ 1 0 5 1 ≤ x i ≤ 1 0 9 1 \le x_i \le 10^9 1 ≤ x i ​ ≤ 1 0 9 Example Input: 8 7 3 5 3 6 2 9 8 Output: 4 #include < bits / stdc ++. h > using namespace std ; void solve (){ int n ; cin >> n ; vector <int> arr ( n ); for ( int i = 0 ; i < n ; i ++)...