teleren/devto huggingface dataset:
Squares of a Sorted Array
Tags: leetcode, dsa, theabbie
Published: 2022-06-11 18:30:41

Given an integer array `nums` sorted in **non-decreasing** order, return _an array of **the squares of each number** sorted in non-decreasing order_.

**Example 1:**

**Input:** nums = \[-4,-1,0,3,10\]
**Output:** \[0,1,9,16,100\]
**Explanation:** After squaring, the array becomes \[16,1,0,9,100\].
After sorting, it becomes \[0,1,9,16,100\].

**Example 2:**

**Input:** nums = \[-7,-3,2,3,11\]
**Output:** \[4,9,9,49,121\]

**Constraints:**

*   `1 <= nums.length <= 104`
*   `-104 <= nums[i] <= 104`
*   `nums` is sorted in **non-decreasing** order.

**Follow up:** Squaring each element and sorting the new array is very trivial, could you find an `O(n)` solution using a different approach?**SOLUTION:**

    class Solution:
        def sortedSquares(self, nums: List[int]) -> List[int]:
            n = len(nums)
            beg = 0
            end = n - 1
            while beg <= end:
                mid = (beg + end) // 2
                if nums[mid] > 0 and nums[mid - 1] < 0:
                    beg = mid
                    break
                elif beg == end:
                    break
                elif nums[mid] < 0:
                    beg = mid + 1
                else:
                    end = mid
            op = []
            i = beg - 1
            j = beg
            while i >= 0 and j <= n - 1:
                if nums[i] * nums[i] < nums[j] * nums[j]:
                    op.append(nums[i] * nums[i])
                    i -= 1
                else:
                    op.append(nums[j] * nums[j])
                    j += 1
            while i >= 0:
                op.append(nums[i] * nums[i])
                i -= 1
            while j <= n - 1:
                op.append(nums[j] * nums[j])
                j += 1
            return op
Git And GitHub Complete Mastery (গিট এন্ড গিট হাব কমপ্লিট মাস্টেরী )
Tags: gitgithub, গিটহাব, github, গিট
Published: 2022-09-15 20:28:17

---
title: Git And GitHub Complete Mastery (গিট এন্ড গিট হাব কমপ্লিট মাস্টেরী  )
published: true
date: 2022-06-11 18:06:43 UTC
tags: GitGitHUb,গিটহাব,GitHub,গিট
canonical_url: https://blog.aldinn.com/git-and-github-complete-mastery-%e0%a6%97%e0%a6%bf%e0%a6%9f-%e0%a6%8f%e0%a6%a8%e0%a7%8d%e0%a6%a1-%e0%a6%97%e0%a6%bf%e0%a6%9f-%e0%a6%b9%e0%a6%be%e0%a6%ac-%e0%a6%95%e0%a6%ae%e0%a6%aa%e0%a7%8d%e0%a6%b2/?utm_source=rss&utm_medium=rss&utm_campaign=git-and-github-complete-mastery-%25e0%25a6%2597%25e0%25a6%25bf%25e0%25a6%259f-%25e0%25a6%258f%25e0%25a6%25a8%25e0%25a7%258d%25e0%25a6%25a1-%25e0%25a6%2597%25e0%25a6%25bf%25e0%25a6%259f-%25e0%25a6%25b9%25e0%25a6%25be%25e0%25a6%25ac-%25e0%25a6%2595%25e0%25a6%25ae%25e0%25a6%25aa%25e0%25a7%258d%25e0%25a6%25b2
---

 ![](data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMjAwIiBoZWlnaHQ9IjYzMCI+PHJlY3Qgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSI+PGFuaW1hdGUgYXR0cmlidXRlTmFtZT0iZmlsbCIgdmFsdWVzPSJyZ2JhKDE1MywxNTMsMTUzLDAuNSk7cmdiYSgxNTMsMTUzLDE1MywwLjEpO3JnYmEoMTUzLDE1MywxNTMsMC41KSIgZHVyPSIycyIgcmVwZWF0Q291bnQ9ImluZGVmaW5pdGUiIC8+PC9yZWN0Pjwvc3ZnPg==)

স্বাগতম আমার git Mastery ব্লগ এ । এই ব্লগ সিরিজটিতে জানবেন কিভাবে একদম শুরু থেকে git এর উপর এক্সপার্ট হওয়া যায় এবং টিম এর সাথে git এ একসাথে কোলাবেরশন করা যায় । তাই দেরী নাহ করে শুরু করে দেই । এই ব্লগ হতে আপনি যা যা জানবেন

1. ফান্ডামেন্টাল কনসেপ্ট
  - [গিট কি](https://blog.aldinn.com/what-is-git/)
  - [গিট এর ব্যাবহার](https://blog.aldinn.com/using-git/)
  - কিভাবে ইন্সটল করতে হয় 
  - কিভাবে কনফিগার করতে হয় 
  - তারপর কিছু গিট টুল এক্সপ্লোর করব 
2. কোড স্ন্যাপশট 
3. ব্রাউজিং প্রজেক্ট হিস্টোরি 
4. ব্রাঞ্চিং অ্যান্ড মার্জিং 
5. কোলাবোরেটিং উইথ গিটহাব 
6. রিরাইটিং হিস্টোরি 

[পরবর্তী পোস্ট](https://blog.aldinn.com/what-is-git/ "পরবর্তী পোস্ট")

রিসোর্স সমুহ:

1.  [official Git project site](https://git-scm.com/) 
2.  [ProGit book](http://git-scm.com/book)
3.  [Git command list](https://git-scm.com/docs)
4. [on-demand training courses](https://skills.github.com/)
5. [on-demand training courses](https://skills.github.com/)
6. [online Git course](https://www.pluralsight.com/courses/code-school-git-real)
The post [Git And GitHub Complete Mastery (গিট এন্ড গিট হাব কমপ্লিট মাস্টেরী )](https://blog.aldinn.com/git-and-github-complete-mastery-%e0%a6%97%e0%a6%bf%e0%a6%9f-%e0%a6%8f%e0%a6%a8%e0%a7%8d%e0%a6%a1-%e0%a6%97%e0%a6%bf%e0%a6%9f-%e0%a6%b9%e0%a6%be%e0%a6%ac-%e0%a6%95%e0%a6%ae%e0%a6%aa%e0%a7%8d%e0%a6%b2/) appeared first on [Aldinn Rocks](https://blog.aldinn.com).
MyNaav Application
Published: 2022-06-11 18:01:10

This application is a java based application. This application basically used for boat booking service at the ghat of Varansi. Their are two panels, one for user and other for boat owner.

**Functioning of the application:**


Firstly, if you are a user, you have to login through your mobile number. We have used firebase method for otp verification. If you are new user then you will be redirected to the signup page. And if you have signed up previously, then you will be redirected to the screen where you can choose your prefrences of the boat size and the ghat. After thta, the available boat owners on that time will be visible to you. Their name and phone will be visible. You have to confirm to the boat owner by calling them if they are available on that time or not. If yes, then you have to proceed for payment and if no, then click on refresh button, another one will be assigned to you immediately. 

For boat owner, if you are signing in for the first time, then you have to login through your phone number and you have to fill the required details. The admin panel will verify your details and approve them if they are correct. After that you wull login again and redirected to the welcome page where you can see your previous rides and current rides as well. If your details are not verified yet, then you see a note on the screen that "you are not verified yet, try after some time". You will not able to take rides if you are not verified.

A boat owner can not be assigned to another user if he already serving the service to a user.

**Database**
 We have used MySql database on which is on "000webhost.com" server. All the database of user, boat owner as well as transaction details is present here.

Admin details is also present here in encrypted format.

**Admin Panel**
Admin panel is a secure password protected panel in which admin can see the details of all the users,as well as all the request of boat owner for their data verification will be accepted from admin panel. All the transaction details are visible here.

We have use php files for the transfer of files from one point to the database.
Filtering an array against another array conditionally
Tags: javascript, functional, ramda
Published: 2022-06-11 17:53:27

In this series of articles we look at several practical use cases and see how we can write clean JavaScript in functional style. You might need a little bit of understanding about functional programming and ramda to follow along.
## Problem statement
We need to build a function that takes an array of strings as `query` and another array of strings as `target`. The function should return an array with those strings in `target` that starts with any item in `query`. 
Lets look at an example.
If `query` is 
```javascript
["pen", "paper"]
```
and `target` is 
```javascript
["pen", "pencil", "paper", "", "books", "paperback"]
```
the result should be 
```javascript
["pen", "pencil", "paper", "paperback"]
```
## Solution
Lets look at the final solution first and then break it down.
{% replit @KuncheriaKuruvi/FilterStringArray %}

Our `textStartsWith` function takes `query` as its argument and returns another function which accepts `target` and returns the result.
If we take a look at the pipe function it becomes more interesting 
```javascript
const textStartsWith = pipe(map(startsWith), anyPass, filter);
```
`map(startsWith)` actually creates an array of predicates, each corresponding to the items in `query`. This list of predicates is passed to `anyPass`. Now what we have is a single predicate with resolves to `true` if a given string starts with any of the strings in `query`. We can now pass this predicate as an argument to filter. Now when you call `textStartsWith` with the list of strings or `query` we get back a filter function with the predicate already partially applied. Now all we need to do is pass the `target` array as an argument to this function.

P.S. If you need more insights to the solution check out this thread on stack overflow {% stackoverflow 67911119 %}
Rings and Rods
Tags: leetcode, dsa, theabbie
Published: 2022-06-11 17:30:37

There are `n` rings and each ring is either red, green, or blue. The rings are distributed **across ten rods** labeled from `0` to `9`.

You are given a string `rings` of length `2n` that describes the `n` rings that are placed onto the rods. Every two characters in `rings` forms a **color-position pair** that is used to describe each ring where:

*   The **first** character of the `ith` pair denotes the `ith` ring's **color** (`'R'`, `'G'`, `'B'`).
*   The **second** character of the `ith` pair denotes the **rod** that the `ith` ring is placed on (`'0'` to `'9'`).

For example, `"R3G2B1"` describes `n == 3` rings: a red ring placed onto the rod labeled 3, a green ring placed onto the rod labeled 2, and a blue ring placed onto the rod labeled 1.

Return _the number of rods that have **all three colors** of rings on them._

**Example 1:**

![](https://assets.leetcode.com/uploads/2021/11/23/ex1final.png)

**Input:** rings = "B0B6G0R6R0R6G9"
**Output:** 1
**Explanation:** 
- The rod labeled 0 holds 3 rings with all colors: red, green, and blue.
- The rod labeled 6 holds 3 rings, but it only has red and blue.
- The rod labeled 9 holds only a green ring.
Thus, the number of rods with all three colors is 1.

**Example 2:**

![](https://assets.leetcode.com/uploads/2021/11/23/ex2final.png)

**Input:** rings = "B0R0G0R9R0B0G0"
**Output:** 1
**Explanation:** 
- The rod labeled 0 holds 6 rings with all colors: red, green, and blue.
- The rod labeled 9 holds only a red ring.
Thus, the number of rods with all three colors is 1.

**Example 3:**

**Input:** rings = "G4"
**Output:** 0
**Explanation:** 
Only one ring is given. Thus, no rods have all three colors.

**Constraints:**

*   `rings.length == 2 * n`
*   `1 <= n <= 100`
*   `rings[i]` where `i` is **even** is either `'R'`, `'G'`, or `'B'` (**0-indexed**).
*   `rings[i]` where `i` is **odd** is a digit from `'0'` to `'9'` (**0-indexed**).

**SOLUTION:**

    class Solution:
        def countPoints(self, rings: str) -> int:
            n = len(rings)
            rods = [set(), set(), set()]
            for i in range(0, n, 2):
                if rings[i] == 'R':
                    rods[0].add(int(rings[i + 1]))
                if rings[i] == 'G':
                    rods[1].add(int(rings[i + 1]))
                if rings[i] == 'B':
                    rods[2].add(int(rings[i + 1]))
            return len(set.intersection(*rods))
Setting up an Environment for Competitive Programming(CP) on Mac🚀
Published: 2022-09-12 18:53:20

---
title: Setting up an Environment for Competitive Programming(CP) on Mac🚀
published: true
date: 2022-06-11 15:20:19 UTC
tags: 
canonical_url: https://blog.sagarmedtiya.me/setting-up-an-environment-for-competitive-programmingcp-on-mac
---
![img](https://cdn.hashnode.com/res/hashnode/image/upload/v1654939429078/o1wWwHjH4.png)
In this environment, we will use c++ language. So, let's begin setting up by installing homebrew.😊

**Step 1 -**  **Install homebrew**

```
/usr/bin/ruby -e $(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

```

**Step 2 - \*\*** Install gcc \*\*

```
brew install gcc

```

**Step 3** - **Install gtimout**

```
brew install coreutils

```

_To confirm if has successfully installed gcc, type `gcc-11 -v` on terminal. At the time of writing this post the version of gcc is 11. After successfully installing gcc and coreutils let's now install sublime for code editor._

**Step 4** - **Install Sublime**

[https://www.sublimetext.com/download\_thanks?target=mac](Link)

**Step 5** - **Configuring the new build system for the Sublime**

- Go to Tools > Build Systems > New Build System.

- Copy the code from C++17.sublime-build and paste it ther and save it by any name.

```
  "cmd" : ["g++-11 $file_name -o $file_base_name && gtimeout 4s ./$file_base_name<inputf.in>outputf.in"], 
  "selector" : "source.c",
  "shell": true,
  "working_dir" : "$file_path"
}

```

- Go to Tools > Build Systems and select your new build system.
- Create 2 files named inputf.in and outputf.in in same directory in which you have your code.
- Write input in inputf.in, save and run the code in sublime and you will get output in outputf.in .

![Success](https://i.gifer.com/3QeQ.gif)Hope you've understood and set up the environment successfully.😊 If you've any problem, you can reach out to me via sagarmedtiya31@gmail.com

Thanks.
Boats to Save People
Tags: leetcode, dsa, theabbie
Published: 2022-06-11 17:00:46

You are given an array `people` where `people[i]` is the weight of the `ith` person, and an **infinite number of boats** where each boat can carry a maximum weight of `limit`. Each boat carries at most two people at the same time, provided the sum of the weight of those people is at most `limit`.

Return _the minimum number of boats to carry every given person_.

**Example 1:**

**Input:** people = \[1,2\], limit = 3
**Output:** 1
**Explanation:** 1 boat (1, 2)

**Example 2:**

**Input:** people = \[3,2,2,1\], limit = 3
**Output:** 3
**Explanation:** 3 boats (1, 2), (2) and (3)

**Example 3:**

**Input:** people = \[3,5,3,4\], limit = 5
**Output:** 4
**Explanation:** 4 boats (3), (3), (4), (5)

**Constraints:**

*   `1 <= people.length <= 5 * 104`
*   `1 <= people[i] <= limit <= 3 * 104`

**SOLUTION:**

    class Solution:
        def numRescueBoats(self, people: List[int], limit: int) -> int:
            people.sort()
            n = len(people)
            ctr = 0
            i, j = 0, n - 1
            while i <= j:
                ctr += 1
                if people[i] + people[j] <= limit:
                    i += 1
                j -= 1
            return ctr
What is Record in Java? What problem does it solve?
Tags: record, corejava, productivity, lesscode
Published: 2022-06-11 16:40:22

For any data intensive applications, we write Java classes that can hold the data as per our requirement.

We need to define the following in most cases :

- Define the variables

- Define the constructor

- Define the getter and setter methods

- Override equals() and hashCode() methods

- Override the toString() method

Although some of these can be auto-generated from IDEs, but lines of code increases with the increasing number of data elements.

Record comes to the rescue and reduces all the boilerplate code we had to write thus far. Record was introduced in Java language as a preview feature in Java SE 14.

_How to define a record?_

```
public record EmployeeRecord(String name, int employeeNumber) {
}
```
Records can be instantiated like a class and attributes can be accessed by getter methods[please note that the the getter method names do not start with getXXXX()]

```
public class RecordExampleTest {
    public static void main(String[] args) {
        EmployeeRecord employeeRecord = new EmployeeRecord("Pradipta", 123);
        System.out.println(String.format("Employee Name : %s , Employee Number : %s",
                employeeRecord.name(), employeeRecord.employeeNumber()));
    }
}
```
Constructor gets automatically generated which is known as _Cannonical Constructor_. The methods like toString(), equals() and hashCode() methods are also automatically generated implicitly.

_Some points to remember :_

- Instance methods and static methods can be created inside a Record.

- Static fields can be declared inside a Record.

- Instance fields cannot be declared inside a Record.

- Records cannot extend any other class as it implicitly extends Record class. As Java does not support Multiple Inheritance, Records cannot extend any other class.

- Records are implicitly final - they cannot be extended by any other classes.

- Records can implement interfaces.

- Although Records provide Cannonical constructor by default, custom constructors can be created as well. It is not necessary to mention the arguments and set them explicitly if  all the arguments to be set as mentioned in the Record. This is also known as _Compact Constructor_. Compact Constructors may be useful if some custom logic needs to be implemented.

The points mentioned above can be represented like below :

```
public record EmployeeRecord(String name, int employeeNumber) {
    private static final String DEFAULT_VALUE = "default-value";

    public EmployeeRecord {
        if(employeeNumber < 0)
            throw new IllegalStateException("Employee Numbers cannot be negative");
    }
    public String generateUniqueNumber() {
        return name + "-" + employeeNumber;
    }

    public static void printSomething() {
        System.out.println("Print anything here...." + DEFAULT_VALUE);
    }
}
```
Determine if String Halves Are Alike
Tags: leetcode, dsa, theabbie
Published: 2022-06-11 16:30:38

You are given a string `s` of even length. Split this string into two halves of equal lengths, and let `a` be the first half and `b` be the second half.

Two strings are **alike** if they have the same number of vowels (`'a'`, `'e'`, `'i'`, `'o'`, `'u'`, `'A'`, `'E'`, `'I'`, `'O'`, `'U'`). Notice that `s` contains uppercase and lowercase letters.

Return `true` _if_ `a` _and_ `b` _are **alike**_. Otherwise, return `false`.

**Example 1:**

**Input:** s = "book"
**Output:** true
**Explanation:** a = "bo" and b = "ok". a has 1 vowel and b has 1 vowel. Therefore, they are alike.

**Example 2:**

**Input:** s = "textbook"
**Output:** false
**Explanation:** a = "text" and b = "book". a has 1 vowel whereas b has 2. Therefore, they are not alike.
Notice that the vowel o is counted twice.

**Constraints:**

*   `2 <= s.length <= 1000`
*   `s.length` is even.
*   `s` consists of **uppercase and lowercase** letters.

**SOLUTION:**

    class Solution:
        def halvesAreAlike(self, s: str) -> bool:
            n = len(s)
            vowels = {'a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'}
            f = len([i for i in range(n // 2) if s[i] in vowels])
            s = len([i for i in range(n // 2, n) if s[i] in vowels])
            return f == s
How to add some security, that anyone not copy your text ? Using CSS!
Tags: webdev, html, css, tutorial
Published: 2022-06-11 16:12:26

It is very common that everyone can easily copy texts from websites, with and the minor problem is that if anybody touches screen for a while automatically test select and options occurs -- **select all copy past extra**, its seems come time ugly & if you want to add some security to text that anyone don't copy than you use this also.
Now write to need little bit css!

```
.container{
    User-select:none;
}
```
I hope you will enjoy this CSS Tip💡
Average of Levels in Binary Tree
Tags: leetcode, dsa, theabbie
Published: 2022-06-11 16:00:44

Given the `root` of a binary tree, return _the average value of the nodes on each level in the form of an array_. Answers within `10-5` of the actual answer will be accepted.

**Example 1:**

![](https://assets.leetcode.com/uploads/2021/03/09/avg1-tree.jpg)

**Input:** root = \[3,9,20,null,null,15,7\]
**Output:** \[3.00000,14.50000,11.00000\]
Explanation: The average value of nodes on level 0 is 3, on level 1 is 14.5, and on level 2 is 11.
Hence return \[3, 14.5, 11\].

**Example 2:**

![](https://assets.leetcode.com/uploads/2021/03/09/avg2-tree.jpg)

**Input:** root = \[3,9,20,15,7\]
**Output:** \[3.00000,14.50000,11.00000\]

**Constraints:**

*   The number of nodes in the tree is in the range `[1, 104]`.
*   `-231 <= Node.val <= 231 - 1`

**SOLUTION:**

    # Definition for a binary tree node.
    # class TreeNode:
    #     def __init__(self, val=0, left=None, right=None):
    #         self.val = val
    #         self.left = left
    #         self.right = right
    class Solution:
        def averageOfLevels(self, root: Optional[TreeNode]) -> List[float]:
            if not root:
                return []
            queue = [(root, 0)]
            levels = {}
            level = 0
            while len(queue) > 0:
                curr, level = queue.pop(0)
                levels[level] = levels.get(level, []) + [curr.val]
                if curr.left:
                    queue.append((curr.left, level + 1))
                if curr.right:
                    queue.append((curr.right, level + 1))
            return [sum(levels[l])/len(levels[l]) for l in range(level + 1)]
M-One Personal Assistant v2.0 - Update: Saturday, June 11, 2022
Tags: python, mone, programming, monepersonalassistant
Published: 2022-06-11 16:00:26

Hello guys,

The M-One was built on Sunday, May 8, 2022, and now has its first update on Saturday, June 11, 2022.

> Version 2.0 (Update: Saturday, June 11, 2022):

M-One in version 2.0 can do 68 things.

Important changes in version 2.0:

Play music, play videos, open photos, take notes and read them, find locations on the map, whois site, weather, check if you are connected to the Internet, open the source code of the application in GitHub and ... More Features -Improved user interface, bug fixes and lots of other problems.

## Core Dependencies
Python 3 (3.9.7)
SpeechRecognition
subprocess (version 2.0)
webbrowser
wikipedia
pyautogui (version 2.0)
translate
requests
pyqrcode
platform (version 2.0)
winshell (version 2.0)
datetime
PyAudio
pyttsx3
random (version 2.0)
urllib
whois (version 2.0)
time
os

Project at GitHub: https://github.com/Mhadi-1382/M-One-personal-assistant

Learn more about M-One: https://dev.to/mhadi2003/m-one-personal-assistant-v10-l0h

> In the future, some features of this program will be added and some of its shortcomings will be eliminated.
You dear ones can also express your opinions and suggestions.
Execute inside a docker container
Tags: docker, commands, shortcutkeys, discuss
Published: 2022-06-11 15:50:12

**dexec < container_id >**

Used to execute a docker container

`dexec(){
docker exec -it "$hello"/bin/bash
echo "$hello"
}`

The above command is used to execute into a docker container. If you use any shortcut command line interface commands feel free to drop below.
WordPress Startseite festlegen, ändern und erstellen
Tags: wordpress, howto
Published: 2022-06-11 16:27:52

---
title: WordPress Startseite festlegen, ändern und erstellen
published: true
date: 2022-06-11 15:43:16 UTC
tags: WordPress,howto
canonical_url: https://bloggerpilot.com/wordpress-startseite-festlegen/
---

![WordPress Startseite festlegen, ändern und erstellen](https://bloggerpilot.com/wp-content/uploads/2022/06/wordpress-startseite-festlegen.png)

WordPress bietet mehrere Möglichkeiten, wie du Inhalte auf der Startseite...

Der Original-Artikel erschien auf [WordPress Startseite festlegen, ändern und erstellen](https://bloggerpilot.com/wordpress-startseite-festlegen/).