Code Monkey home page Code Monkey logo

problemsolving--arabic-ii's Introduction

Table of Contents

About

Prerequisites

The basics covered in this training:
https://github.com/MohamedAfifii/ProblemSolving--Arabic

Repo structure

Lessons (in the README file)

Lessons will usually contain:

  • Resources covering the specified topic
  • Extra notes (either videos or text) on points not covered by the resources
  • Problems

Problem categories

Problems will usually be divided to:

  • Basic problems: These are the problems that you should not skip. If you struggle with a basic problem, go read the solution to get the idea, then implement the solution on your own.
  • Extra problems: These are usually harder problems. Feel free to skip these and get back to them later when you finish the training if you need more practice on a certain topic.
  • Refresh problems: These problems are not related to the topic covered by the lesson, they will usually be
    • Problems on older topics
    • Ad-hock or greedy problems

Problems are sorted according to difficulty.

Material

I will put the source code used in the videos that I record there.

Solutions

This directory contains documented solutions for the training problems. If the solution isn't straightforward, you will find an explanation above the main function.

It is highly recommended that you read through the solutions even if you solve the problem, as you may find useful tricks there!

Lessons

1. Number Theory: Factorization and Sieve of Eratosthenes

Resources

Read these two short PDFs:

Watch these two videos by Mustafa Saad:

Watch this video that highlights important points that were not highlighted by the resources above:

Notes

The code in the last video can be easily modified to generate all the divisors (not only the prime divisors) for all numbers from 1 to N.

int n = 10;
vector<vector<int>> divisors(n+1);

//i starts from 1
//All numbers (not only prime numbers) will visit their multiples
for(int i = 1; i <= n; i++)    
{
    for(int j = i; j <= n; j += i)
    {
        divisors[j].push_back(i);
    }
}

The complexity of this algorithm is O(NlogN) (assuming that push_back is O(1) for simplicity). The proof is similar to the proof mentioned in Codility's PDF, except that the summation is now over all numbers from 1 to N. See this interesting derivation if you want to know why the upper bound for the summation is indeed O(logN) (feel free to skip the proof).

Problems

As this is an extremely important topic that frequently appears on programming contests, please solve all the following problems:

Extra
If the above problems were easy for you and you want to go fancier, read this link about Segment Sieve, then give the following problems a try:

2. Number Theory: GCD, LCM, Extended Euclidean Algorithm

Resources

Problems

GCD, LCM Problems

Extended Euclid Problems

Note that problems that involve using the Extended Euclidean Algorithm are usually hard problems, so don't get disappointed if you struggle with them. I will try to provide easy to read solutions so that you can understand the solution if you get stuck!

Extra

3. Trees: Minimum Spanning Trees

Refresh: DSU

Resources

Watch these two videos by Mustafa Saad:

Problems

4. Trees: Tree Center and Diameter

Refresh: DFS, BFS

Resources

Problems

5. DP - Warm Up

Resources

Read this lesson from Codility

Watch these 3 videos by Mustafa Saad

Problems

6. DP - Table Method and Patterns

Resources

Problems

7. DP - Tricks and Masks

Resources

Problems

Subarrays

State Graphs

Consider One Element

Masks

8. Segment Tree

Resources

Problems

Without lazy propagation

Lazy Propagation

9. Trees - Binary Lifting, K'th Ancestor, Lowest Common Ancestor

Resources

Problems

Basic

A little bit harder

problemsolving--arabic-ii's People

Contributors

mohamedafifii avatar conancode96 avatar bassel-bakr avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.