Finding the majority element in an array
Problem Statement Given an array of size n, find the majority element. What is the majority element in an array? The majority element is the element that occurs more than half of the size of the array i.e the element should occur more than (⌊ N/2 ⌋) times. You may assume that the array is non-empty…
https://thecodingbot.com/finding-the-majority-element-in-an-array/
Problem Statement Given an array of size n, find the majority element. What is the majority element in an array? The majority element is the element that occurs more than half of the size of the array i.e the element should occur more than (⌊ N/2 ⌋) times. You may assume that the array is non-empty…
https://thecodingbot.com/finding-the-majority-element-in-an-array/
The Coding Bot
Finding the majority element in an array - The Coding Bot
In this aproach, we will discuss 4 different ways to find the majority element in the array using C++.
Leetcode – 169. Majority Element
Problem Statement Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that the array is non-empty and the majority element always exist in the array. Example 1: Input: [3,2,3] Output: 3 Example 2: Input: [2,2,1,1,1,2,2] Output: 2 (you can solve the…
https://thecodingbot.com/leetcode-169-majority-element/
Problem Statement Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that the array is non-empty and the majority element always exist in the array. Example 1: Input: [3,2,3] Output: 3 Example 2: Input: [2,2,1,1,1,2,2] Output: 2 (you can solve the…
https://thecodingbot.com/leetcode-169-majority-element/
The Coding Bot
Leetcode - 169. Majority Element - The Coding Bot
In this tutorial, we will discuss different approaches to solve leetcode 169 Majority Element in C++.
Computer Programming
django-admin-cookbook-latest.pdf
How to customize Django admin panel cookbook
LeetCode – 182. Duplicate Emails
Write a SQL query to find all duplicate emails in a table named Person. +----+---------+ | Id | Email | +----+---------+ | 1 | a@b.com | | 2 | c@d.com | | 3 | a@b.com | +----+---------+ For example, your query should return the following for the above table: +---------+ | Email | +---------+ | a@b.com…
https://thecodingbot.com/leetcode-182-duplicate-emails/
Write a SQL query to find all duplicate emails in a table named Person. +----+---------+ | Id | Email | +----+---------+ | 1 | a@b.com | | 2 | c@d.com | | 3 | a@b.com | +----+---------+ For example, your query should return the following for the above table: +---------+ | Email | +---------+ | a@b.com…
https://thecodingbot.com/leetcode-182-duplicate-emails/
The Coding Bot
LeetCode - 182. Duplicate Emails - The Coding Bot
In this tutorial, we will discuss different approaches to solve leetcode problem 182 duplicate emails
LeetCode – 595. Big Countries
Problem Statement There is a table World +-----------------+------------+------------+--------------+---------------+ | name | continent | area | population | gdp | +-----------------+------------+------------+--------------+---------------+ | Afghanistan | Asia | 652230 | 25500100 | 20343000 | | Albania | Europe | 28748 | 2831741 | 12960000 | | Algeria | Africa | 2381741 | 37100000 | 188681000 | | Andorra |…
https://thecodingbot.com/leetcode-595-big-countries/
Problem Statement There is a table World +-----------------+------------+------------+--------------+---------------+ | name | continent | area | population | gdp | +-----------------+------------+------------+--------------+---------------+ | Afghanistan | Asia | 652230 | 25500100 | 20343000 | | Albania | Europe | 28748 | 2831741 | 12960000 | | Algeria | Africa | 2381741 | 37100000 | 188681000 | | Andorra |…
https://thecodingbot.com/leetcode-595-big-countries/
The Coding Bot
LeetCode - 595. Big Countries - The Coding Bot
In this approach, we will see different solutions to solve leetcode 595 big countries.
LeetCode – 627. Swap Salary
Problem Statement Given a table salary, such as the one below, that has m=male and f=female values. Swap all f and m values (i.e., change all f values to m and vice versa) with a single update…
https://thecodingbot.com/leetcode-627-swap-salary/
Problem Statement Given a table salary, such as the one below, that has m=male and f=female values. Swap all f and m values (i.e., change all f values to m and vice versa) with a single update…
https://thecodingbot.com/leetcode-627-swap-salary/
The Coding Bot
LeetCode - 627. Swap Salary - The Coding Bot
In this tutorial, we will learn how to solve leetcode 627 swap salary using different approaches.
LeetCode – 620. Not Boring Movies
Problem Statement X city opened a new cinema, many people would like to go to this cinema. The cinema also gives out a poster indicating the movies’ ratings and descriptions. Please write a SQL query…
https://thecodingbot.com/leetcode-620-not-boring-movies/
Problem Statement X city opened a new cinema, many people would like to go to this cinema. The cinema also gives out a poster indicating the movies’ ratings and descriptions. Please write a SQL query…
https://thecodingbot.com/leetcode-620-not-boring-movies/
The Coding Bot
LeetCode - 620. Not Boring Movies - The Coding Bot
In this tutorial, we will learn different approaches to solve leetcode 620 - Not Boring Movies.
LeetCode – 197. Rising Temperature
Given a Weather table, write a SQL query to find all dates’ Ids with higher temperature compared to its previous (yesterday’s) dates. +---------+------------------+------------------+ | Id(INT) | RecordDate(DATE) | Temperature(INT) | +---------+------------------+------------------+ | 1 | 2015-01-01 | 10…
https://thecodingbot.com/leetcode-197-rising-temperature/
Given a Weather table, write a SQL query to find all dates’ Ids with higher temperature compared to its previous (yesterday’s) dates. +---------+------------------+------------------+ | Id(INT) | RecordDate(DATE) | Temperature(INT) | +---------+------------------+------------------+ | 1 | 2015-01-01 | 10…
https://thecodingbot.com/leetcode-197-rising-temperature/
The Coding Bot
LeetCode - 197. Rising Temperature - The Coding Bot
In this tutorial, we will discuss how to solve leetcode 197 rising temperature problem in great detail.
Computer Programming
LeetCode – 197. Rising Temperature Given a Weather table, write a SQL query to find all dates’ Ids with higher temperature compared to its previous (yesterday’s) dates. +---------+------------------+------------------+ | Id(INT) | RecordDate(DATE) | Temperature(INT)…
Similar problem asked in google, amazon. Try out yourself.
Today's topic is Design Patterns in C++
Design patterns : In software engineering, a design pattern is a general repeatable solution to a commonly occurring problem in software design. A design pattern isn't a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that can be used in many different situations.
Here are resources:
Blogs:
1. https://www.bogotobogo.com/DesignPatterns/introduction.php
2. https://readthedocs.org/projects/cpp-design-patterns/downloads/pdf/latest/
3. https://caiorss.github.io/C-Cpp-Notes/cpp-design-patterns.html
Youtube:
1. cppcon 2019 modern C++ design pattern : https://www.youtube.com/watch?v=MdtYi0vvct0
2. https://www.youtube.com/watch?v=j9arNRRoPe8 (1 hour tutorial)
3. Playlist: https://www.youtube.com/watch?v=8tbxQ2IUtvE&list=PLiLpmqwkwkCsgR__zwKVB0s4bIYrF8vWu
Paid Courses:
1. https://www.pluralsight.com/paths/c-design-patterns
Books:
1. Modern C++ Design
2. Design Patterns: Elements of Reusable Object-Oriented Software
Design patterns : In software engineering, a design pattern is a general repeatable solution to a commonly occurring problem in software design. A design pattern isn't a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that can be used in many different situations.
Here are resources:
Blogs:
1. https://www.bogotobogo.com/DesignPatterns/introduction.php
2. https://readthedocs.org/projects/cpp-design-patterns/downloads/pdf/latest/
3. https://caiorss.github.io/C-Cpp-Notes/cpp-design-patterns.html
Youtube:
1. cppcon 2019 modern C++ design pattern : https://www.youtube.com/watch?v=MdtYi0vvct0
2. https://www.youtube.com/watch?v=j9arNRRoPe8 (1 hour tutorial)
3. Playlist: https://www.youtube.com/watch?v=8tbxQ2IUtvE&list=PLiLpmqwkwkCsgR__zwKVB0s4bIYrF8vWu
Paid Courses:
1. https://www.pluralsight.com/paths/c-design-patterns
Books:
1. Modern C++ Design
2. Design Patterns: Elements of Reusable Object-Oriented Software
Rearrange a linked list such that all even index nodes come after all odd index nodes
Problem Statement Given a singly linked list, group all odd nodes together followed by all the even nodes. Please note here we are talking about the node number and not the value in the nodes.…
https://thecodingbot.com/rearrange-a-linked-list-such-that-all-even-index-nodes-come-after-all-odd-index-nodes/
Problem Statement Given a singly linked list, group all odd nodes together followed by all the even nodes. Please note here we are talking about the node number and not the value in the nodes.…
https://thecodingbot.com/rearrange-a-linked-list-such-that-all-even-index-nodes-come-after-all-odd-index-nodes/
The Coding Bot
Rearrange a linked list such that all even index nodes come after all odd index nodes - The Coding Bot
In this tutorial, we will see diffferent approached to rearrange a linked list such that all even index nodes come after all odd index nodes.
Today is Python day and topic for today is "Mutable and Immutable Objects in Python"
You might use Python daily, but do you really go into details to know what you are doing and most importantly why are you doing certain operation?
Mutable and Immutable objects are one of the most important topic in Python and you might be asked about them in any interview.
Complete tutorial: https://medium.com/@meghamohan/mutable-and-immutable-side-of-python-c2145cf72747
Or, Complete tutorial 2: https://hackernoon.com/python-objects-and-mutability-397f7de38bb5
Or, Complete tutorial 3: https://thecodingbot.com/pythons-built-in-id-with-examples/ (contains multiple examples supporting it)
You might use Python daily, but do you really go into details to know what you are doing and most importantly why are you doing certain operation?
Mutable and Immutable objects are one of the most important topic in Python and you might be asked about them in any interview.
Complete tutorial: https://medium.com/@meghamohan/mutable-and-immutable-side-of-python-c2145cf72747
Or, Complete tutorial 2: https://hackernoon.com/python-objects-and-mutability-397f7de38bb5
Or, Complete tutorial 3: https://thecodingbot.com/pythons-built-in-id-with-examples/ (contains multiple examples supporting it)
Medium
Mutable vs Immutable Objects in Python
Everything in Python is an object. And what every newcomer to Python should quickly learn is that all objects in Python can be either…
596. Classes More Than 5 Students
Problem Statement There is a table courses with columns: student and class Please list out all classes which have more than or equal to 5 students. For example, the table: +---------+------------+ | student | class | +---------+------------+ | A |…
https://thecodingbot.com/596-classes-more-than-5-students/
Problem Statement There is a table courses with columns: student and class Please list out all classes which have more than or equal to 5 students. For example, the table: +---------+------------+ | student | class | +---------+------------+ | A |…
https://thecodingbot.com/596-classes-more-than-5-students/
The Coding Bot
596. Classes More Than 5 Students - The Coding Bot
Table of Contents Problem StatementSolutionApproach 1 – Using the subqueryApproach 2 – Using the group by clause along with having Problem Statement There is a table courses with columns: student and class Please list out all classes which have more than…
It is sunday today and I post from random topic. Today, let's have some machine learning as our breakfast.
Here's a two part guide to hypertune the XGboost algorithm(very very important for kaggle winning)
Tut 1: https://towardsdatascience.com/doing-xgboost-hyper-parameter-tuning-the-smart-way-part-1-of-2-f6d255a45dde
------------------------+----------------+-------------+
Another tutorial:
Part 1 - https://blog.cambridgespark.com/getting-started-with-xgboost-3ba1488bb7d4
Part 2 - https://blog.cambridgespark.com/hyperparameter-tuning-in-xgboost-4ff9100a3b2f
Both are nice reads. Enjoy.
(thecodingbot.com, @computerprogrammingcodingbot)
Here's a two part guide to hypertune the XGboost algorithm(very very important for kaggle winning)
Tut 1: https://towardsdatascience.com/doing-xgboost-hyper-parameter-tuning-the-smart-way-part-1-of-2-f6d255a45dde
------------------------+----------------+-------------+
Another tutorial:
Part 1 - https://blog.cambridgespark.com/getting-started-with-xgboost-3ba1488bb7d4
Part 2 - https://blog.cambridgespark.com/hyperparameter-tuning-in-xgboost-4ff9100a3b2f
Both are nice reads. Enjoy.
(thecodingbot.com, @computerprogrammingcodingbot)
Medium
Doing XGBoost hyper-parameter tuning the smart way — Part 1 of 2
In this post and the next, we will look at one of the trickiest and most critical problems in Machine Learning (ML): Hyper-parameter…
LeetCode – 1295. Find Numbers with Even Number of Digits
Problem Statement Given an array nums of integers, return how many of them contain an even number of digits. Example 1: Input: nums = [12,345,2,6,7896] Output: 2 Explanation: 12 contains 2 digits (even number of digits). 345 contains 3…
https://thecodingbot.com/leetcode-1295-find-numbers-with-even-number-of-digits/
Problem Statement Given an array nums of integers, return how many of them contain an even number of digits. Example 1: Input: nums = [12,345,2,6,7896] Output: 2 Explanation: 12 contains 2 digits (even number of digits). 345 contains 3…
https://thecodingbot.com/leetcode-1295-find-numbers-with-even-number-of-digits/
The Coding Bot
LeetCode - 1295. Find Numbers with Even Number of Digits - The Coding Bot
In this tutorial, we will see different approaches to solve leetcode-1295 Find Numbers with Even Number of Digits
Python’s built-in id() method with examples
In this tutorial, we will talk about a built-in method in Python, and that method is id(). We will talk about its syntax, where is it used, what parameters it takes and what value it returns.…
https://thecodingbot.com/pythons-built-in-id-with-examples/
In this tutorial, we will talk about a built-in method in Python, and that method is id(). We will talk about its syntax, where is it used, what parameters it takes and what value it returns.…
https://thecodingbot.com/pythons-built-in-id-with-examples/
The Coding Bot
Python's built-in id() method with examples - The Coding Bot
In this article, we will discuss about built-in id() method in Python. It returns the "identity" of an object an integer which is unique and constant for an object during its lifetime..
LeetCode – 1108. Defanging an IP Address
Problem Statement Given a valid (IPv4) IP address, return a defanged version of that IP address. A defanged IP address replaces every period "." with "[.]". Example 1: Input: address = "1.1.1.1" Output: "1[.]1[.]1[.]1" Example 2: Input: address = "255.100.50.0" Output: "255[.]100[.]50[.]0"…
https://thecodingbot.com/leetcode-1108-defanging-an-ip-address/
Problem Statement Given a valid (IPv4) IP address, return a defanged version of that IP address. A defanged IP address replaces every period "." with "[.]". Example 1: Input: address = "1.1.1.1" Output: "1[.]1[.]1[.]1" Example 2: Input: address = "255.100.50.0" Output: "255[.]100[.]50[.]0"…
https://thecodingbot.com/leetcode-1108-defanging-an-ip-address/
The Coding Bot
LeetCode - 1108. Defanging an IP Address - The Coding Bot
In this tutorial, we will see how we can solve leetcode 1108 Defanging an IP Address using C++.
Hi, Today's topic is Testing in Django
Here are some resources:
Blog
1. https://realpython.com/testing-in-django-part-1-best-practices-and-examples/
2. https://realpython.com/testing-in-django-part-2-model-mommy-vs-django-testing-fixtures/
Youtube
1. https://youtu.be/WWa4bzTJZgI
2. https://youtu.be/6tNS--WetLI
Happy Coding (thecodingbot.com,t.me/computerprogrammingcodingbot)
Here are some resources:
Blog
1. https://realpython.com/testing-in-django-part-1-best-practices-and-examples/
2. https://realpython.com/testing-in-django-part-2-model-mommy-vs-django-testing-fixtures/
Youtube
1. https://youtu.be/WWa4bzTJZgI
2. https://youtu.be/6tNS--WetLI
Happy Coding (thecodingbot.com,t.me/computerprogrammingcodingbot)
Github Project for testing guide in Django:
1. https://github.com/toastdriven/guide-to-testing-in-django
2. https://github.com/wsvincent/django-testing-tutorial
1. https://github.com/toastdriven/guide-to-testing-in-django
2. https://github.com/wsvincent/django-testing-tutorial