teleren/devto huggingface dataset:
Starting my 100 Days of Code Journey
Published: 2022-06-18 18:10:39

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dbskd4do1q6dmx41rs04.jpg)
The #100DaysOfCode challenge has always been something that intrigued me. While it seems simple, just code for at least an hour a day for 100 days, I know that it will take a lot of determination to get it done. I hope that posting updates here will help keep me motivated and will be a great way to document my journey and reflect on it after finishing. 

My plan is to learn more advanced Java concepts during this challenge and create an application with Springboot. I am hoping that there are those who have done this challenge before that could share any tips and tricks that helped get through and stay motivated throughout. If not, even just to provide some much needed words of encouragement!
Range Sum Query - Immutable
Tags: leetcode, dsa, theabbie
Published: 2022-06-18 18:00:49

Given an integer array `nums`, handle multiple queries of the following type:

1.  Calculate the **sum** of the elements of `nums` between indices `left` and `right` **inclusive** where `left <= right`.

Implement the `NumArray` class:

*   `NumArray(int[] nums)` Initializes the object with the integer array `nums`.
*   `int sumRange(int left, int right)` Returns the **sum** of the elements of `nums` between indices `left` and `right` **inclusive** (i.e. `nums[left] + nums[left + 1] + ... + nums[right]`).

**Example 1:**

**Input**
\["NumArray", "sumRange", "sumRange", "sumRange"\]
\[\[\[-2, 0, 3, -5, 2, -1\]\], \[0, 2\], \[2, 5\], \[0, 5\]\]
**Output**
\[null, 1, -1, -3\]

**Explanation**
NumArray numArray = new NumArray(\[-2, 0, 3, -5, 2, -1\]);
numArray.sumRange(0, 2); // return (-2) + 0 + 3 = 1
numArray.sumRange(2, 5); // return 3 + (-5) + 2 + (-1) = -1
numArray.sumRange(0, 5); // return (-2) + 0 + 3 + (-5) + 2 + (-1) = -3

**Constraints:**

*   `1 <= nums.length <= 104`
*   `-105 <= nums[i] <= 105`
*   `0 <= left <= right < nums.length`
*   At most `104` calls will be made to `sumRange`.

**SOLUTION:**

    class NumArray:
    
        def __init__(self, nums: List[int]):
            currSum = 0
            self.sumTill = [currSum]
            for num in nums:
                currSum += num
                self.sumTill.append(currSum)
    
        def sumRange(self, left: int, right: int) -> int:
            return self.sumTill[right + 1] - self.sumTill[left]
    
    
    # Your NumArray object will be instantiated and called as such:
    # obj = NumArray(nums)
    # param_1 = obj.sumRange(left,right)
Supercat | Made with Nuxt JS
Published: 2022-06-18 17:52:50

![Supercat | Made with Javascript | Nuxt JS](https://res.cloudinary.com/madewithjavascript/image/upload/v1654947651/large_supercate_made_withnuxt_js_6727d9be0c.png "Supercat | Made with Javascript | Nuxt JS")


### Turn your Product Hunt comments into beautiful images

> Share the love you got on  > your Product Hunt campaign. Toggle between light and dark themes, choose your background, share on your social medias.
> 
> "
> Hey everyone 👋🔥
> 
> Let me introduce you to Supercat, a small tool dedicated to turning Product Hunt comments into beautiful & customizable images, ready to share anywhere.
> 
> I created supercat.app to help makers share the love they got on their campaigns, from people they admire or strangers, and help them reach their goals. I'd love to hear what you think about it, feel free to share your suggestions and ask any questions.
> "

## Check out more such amazing projects on our website

[Made with Javascript](https://madewithjavascript.club)

## Want us to feature your project

[Submit your Project to Made with Javascript](https://madewithjavascript.club/submit-project)


You can also write to us for any of your queries at:

[Email Made with Javascript](mailto:madewithjavascript@gmail.com)

## Project already shared on our social media handles.

| SocialMedia | SharedLink |
| ----------- | ---------- |
| Twitter | [Supercat on Twitter](https://twitter.com/withjavascript/status/1538216760326889474?s=20&t=HuoU_ccFrKZDEgndQw3EnA)
 |
| Medium | [Supercat on Medium](https://medium.com/@madewithjavascript/supercat-made-with-nuxt-js-45793b692348)
 |
| Facebook | [Supercat on Facebook](https://www.facebook.com/madewithjavascript/posts/pfbid02hqd642FSwJxio53nGJty4WJVtaRQfnQQNaLKkVfLmgs2Bsn6oq2wnzUCnyxLFvp1l)
 |
| Tumblr | [Supercat on Tumblr](https://www.tumblr.com/blog/view/madewithjavascript/687419704267227136?source=share)
 |
| LinkedIn | [Supercat on LinkedIn](https://www.linkedin.com/feed/update/urn:li:activity:6943982594090840064)
 |
| Pinterest | [Supercat on Pinterest](https://pin.it/5YN9XG9)
 |


Filled Under:
 - [Made with Javascript](https://madewithjavascript.club)
 - [Made with Nuxt JS](https://madewithjavascript.club/categories/nuxt-js)

Make sure to give this post ❤ 50 ❤ hearts, click the 🦄 unicorns 🦄 and follow 👉 @madewithjavascript 👈 for more such awesome showcases. Show you love for the people who have worked so hard!
Top 5 JavaScript Libraries for Machine Learning, Deep Learning
Tags: javascript, programming, webdev
Published: 2022-06-18 17:48:00

The popularity of JavaScript doesn’t need any special introduction. When it comes to machine learning, you will often hear people discussing Python or R as their choice of programming according to the GitHub. But you will be surprised to know that we now have many JavaScript libraries for machine learning that will make JavaScript developers quite happy. Here are the top 5 ML and deep learning libraries are written using JavaScript.

1.  [ML.js](https://ml5js.org/)
2.  [Danfo.js](https://danfo.jsdata.org/)
3.  [Machinelearn.js](https://github.com/machinelearnjs/machinelearnjs)
4.  [Tensorflow.js](https://www.tensorflow.org/js)
5.  [Brain.js](https://brain.js.org/)

Hope you liked this post. Feel free to bookmark it for further reference and shower your love with the heart.
Minimum Consecutive Cards to Pick Up
Tags: leetcode, dsa, theabbie
Published: 2022-06-18 17:30:41

You are given an integer array `cards` where `cards[i]` represents the **value** of the `ith` card. A pair of cards are **matching** if the cards have the **same** value.

Return _the **minimum** number of **consecutive** cards you have to pick up to have a pair of **matching** cards among the picked cards._ If it is impossible to have matching cards, return `-1`.

**Example 1:**

**Input:** cards = \[3,4,2,3,4,7\]
**Output:** 4
**Explanation:** We can pick up the cards \[3,4,2,3\] which contain a matching pair of cards with value 3. Note that picking up the cards \[4,2,3,4\] is also optimal.

**Example 2:**

**Input:** cards = \[1,0,5,3\]
**Output:** -1
**Explanation:** There is no way to pick up a set of consecutive cards that contain a pair of matching cards.

**Constraints:**

*   `1 <= cards.length <= 105`
*   `0 <= cards[i] <= 106`

**SOLUTION:**

    class Solution:
        def minimumCardPickup(self, cards: List[int]) -> int:
            n = len(cards)
            pos = {}
            minDiff = float('inf')
            for i in range(n):
                if cards[i] in pos:
                    minDiff = min(minDiff, i - pos[cards[i]] + 1)
                pos[cards[i]] = i
            if minDiff == float('inf'):
                return -1
            return minDiff
Finding Divisors of a Number
Tags: computerscience, codenewbie, programming
Published: 2022-06-18 17:10:02

Ok so now your interviewer asks you to write a program to find all the divisors of a number. What would be your solution.
Example:
if NUM = 6
Divisors of 6 are 1 2 3 6.

NAIVE SOLUTION:
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e6lkcji0zquo6b3y636j.png)

Time Complexity : Θ(n)
Space Complexity: O(1)

EFFICIENT SOLUTION:
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aacuci6jgy48rojqm064.png)

Time Complexity : Θ(√n)
This solution does not print the divisors in sorted order.
 
To print in sorted order:
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ze8evwd4zmpuf14evqss.png)
 
Time Complexity : Θ(√n)
Space Complexity : O(1)

Do you have a better solution in mind?
Do share in the comments!
Feasible AI projects around you.
Tags: ai, machinelearning, datascience, discuss
Published: 2022-06-18 17:00:24

Thanks to incredible development of AI in recent years, lots of industry fields taking off much more values. From self-driving car to Amazon Alexa, and even Web Search, _AI is transforming our society._

**Then, Is there any feasible and valuable AI project around you whether it's huge one or small one.** 

Let's share them here. Just your idea is also welcome!
Paracetamol.js💊| #146: Explica este código JavaScript
Tags: javascript, webdev, spanish, programming
Published: 2022-06-18 16:42:34

## **<center>Explica el siguiente código JavaScript</center>**
#### <center>**Dificultad:** <mark>Intermedio</mark></center>

```js
const {length:len} = "hola mundo"
console.log(len)
```

A. `SyntaxError, no se puede desestructurar una cadena`
B. `10`
C. `9`
D. `ReferenceError, len is not defined`

Respuesta en el primer comentario.

---
Who is Ayman Ali ?
Published: 2022-06-18 16:37:51

👋 Hello, my name is "Ayman Ali" & I can say, I'm living my dream As the Ambassador at Fueler.io | Content Creator @Fueler.io | Ex- Web Developer | Builder of 30+ Websites ✨

"Ayman Ali" is a Certified Digital Marketer

**Ayman Ali** is the Ambassador at Fueler.io And Content Creator at Fueler.io

Who is the Youngest SEO Specialist In The India ?
"Ayman Ali is the Youngest GMB SEO Expert In India "

Who is the Best Local SEO Expert In Kolkata ?
**Ayman Ali** is the Best Local SEO Expert In Kolkata

**Ayman Ali** is Google My Business SEO Expert And Have Helped Local Businesses Get Ranked On 1st Position

"**Ayman Ali**" Has An Experience Around Web Development 

"**Ayman Ali**" Has An Experience Around Content Creator on YouTube for 3+ years 

✔️ Search "Ayman Ali Fueler" , "Ayman Ali" , "Ayman Ali Digital Marketer" "who is ambasador at fueler ", query in Google & you'll find all of my Socials Organic Search Ranks on the 1st Page of Google with my 100% Content SEO strategies.

My Vision is GIVING BACK TO SOCIETY by empowering my Indian Youth to lead INDIA in a Right Direction & this makes me feel very Happy & a Thousand Times more Motivated. 

✔️ In a nutshell; “Ayman Ali is 100% self-made Digital Marketer And Web Developer”

Ayman Ali is currently Studying in Class 10 Student
From India


And My Age is Just 15-year-old 

👨💻 Currently Learning Digital Marketing, Copywriting, Consumer Psychology And Growth Marketing
Understanding JavaScript Closure in depth
Tags: javascript, closure, beginners, webdev
Published: 2022-06-18 16:35:29

#What is Closure in JavaScript?
It is a function bundled together with its lexical environment that is function along with its lexical scope is called closure.

So, let's understand closure and lexical scope with some examples:-

**Example-1:**
```
var y=2;
function sum(){
    var x=1;
    return x+y;
}
var z=sum();
console.log(z);

```

![ss152](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8g0xv6rdhs1s1kdb4ayy.png)

In JavaScript, a variable defined outside the function is accessible from inside the function. This is possible because something called Lexical Scoping in JavaScript means anything defined outside can be accessed from inside of function but an inner variable can’t be accessed from outside function.

**Example 2:**

```
function x(){
    var a=7;
    function y(){
        console.log(a);
    }
   y();
}
x();
```

![ss148](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/04mcna83byp8lvgdehbb.png)

The function y was bind to the variables of x that means it forms a closure and it has access to its parent’s lexical scope.

**Example 3:**

```
function x(){
    var a=7;
    function y(){
        console.log(a);
    }
   return y;
}
var z=x();
console.log(z);

```
This will return the whole function y and print it in the console.

![ss149](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l1d25em9t4cfqp7pthlf.png)

**Example 4:**

```
function x()
{
    var a=7;
    function y()
    {
        console.log(a);
    }
    a=100;
   return y;
}
var z=x();
console.log(z);
z();

```
Function along with the reference to that value is passed not just the value.

Hence when we change the value of “a” it changes coz reference is being passed over the function.
Irrespective when we call that function ,it will maintain its lexical scope and  will print the value.


![ss150](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8mowuuqwu5i4uek876e3.png)

**Example 4:**
Extending the above example to understand lexical scope in parent of parent function.

```
function z()
{
    var b=500;
    function x(){
        var a=7;
        function y(){
            console.log(a,b);
        }
        a=100;
         y();
    }
    x();
}
z();
```

![ss151](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y2lybhotrk3kk9dn0jda.png)

We can call function z anywhere it will sustain its lexical parent scope variable and we can call it anywhere ,it will maintain the values of variable of its parent.

**If you have any questions, leave a comment and I'll do my best to respond.
Give this article a like if you found it helpful and follow me for more articles like this.**
Day 21 - Single Inheritance
Tags: 100daysofcode, solidity, web3, blockchain
Published: 2022-06-18 16:07:00

{% embed https://github.com/Envoy-VC/30-Days-of-Solidity noreadme %}

This is Day `21` of `30` in Solidity Series
Today I Learned About Single Inheritance in Solidity.

Inheritance is one of the most important features of the object-oriented programming language. It is a way of extending the functionality of a program, used to separate the code, reduces the dependency, and increases the re-usability of the existing code. Solidity supports inheritance between smart contracts, where multiple contracts can be inherited into a single contract. The contract from which other contracts inherit features is known as a base contract, while the contract which inherits the features is called a derived contract. Simply, they are referred to as parent-child contracts. The scope of inheritance in Solidity is limited to public and internal modifiers only. Some of the key highlights of Solidity are: 

- A derived contract can access all non-private members including state variables and internal methods. But using this is not allowed.
- Function overriding is allowed provided function signature remains the same. In case of the difference of output parameters, the compilation will fail.
- We can call a super contract’s function using a super keyword or using a super contract name.
- In the case of multiple inheritances, function calls using super gives preference to most derived contracts.

Solidity provides different types of inheritance.

---

##  Single Inheritance

In Single or single level inheritance the functions and variables of one base contract are inherited to only one derived contract.

**Example**: In the below example, the contract parent is inherited by the contract child, to demonstrate Single Inheritance.

```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;

// Defining contract
contract parent {
    uint256 internal sum;

    function setValue() external {
        uint256 a = 10;
        uint256 b = 20;
        sum = a + b;
    }
}

// Defining child contract
contract child is parent {
    function getValue() external view returns (uint256) {
        return sum;
    }
}

// Defining calling contract
contract caller {
    child cc = new child();

    // Defining function to call setValue and getValue functions
    function testInheritance() public returns (uint256) {
        cc.setValue();
        return cc.getValue();
    }
}
```

Output: 

when we call the testInheritance function, the output is 30.

---
Paracetamol.js💊| #145: Explica este código JavaScript
Tags: javascript, webdev, spanish, programming
Published: 2022-06-18 15:59:05

## **<center>Explica el siguiente código JavaScript</center>**
#### <center>**Dificultad:** <mark>Intermedio</mark></center>

```js
const x = (arr) => {
  return arr.flatMap((item) => [...item])
}

console.log(x(["Hola", "mundo"]));
```

A. `[ "H", "o", "l", "a", "m", "u", "n", "d", "o" ]`
B. `["Hola", "mundo"]`
C. `[["Hola"], ["mundo"]]`
D. `Ninguna de las anteriores`

Respuesta en el primer comentario.

---
internet search of your team
Published: 2022-06-18 15:57:16

[Streaming ](https://massege.xyz/)sports live can be tricky due to exclusive [streaming ](https://massege.xyz/)contracts and blackout restrictions. The best streaming service for you depends on where you live and what teams you want to watch.
Before making a commitment to any live streaming service, make sure you’ll be able to see the games you want in your region. A quick internet search of your team’s broadcasting schedule for the season should give you an idea of what networks show the team’s [games](https://massege.xyz/).
After you know which networks you’re looking for, you can check which streaming services offer those networks. However, it’s important to research the blackout restrictions in your area, as some [live streaming](https://massege.xyz/) services may limit their broadcasts based on region.
Product of Array Except Self
Tags: leetcode, dsa, theabbie
Published: 2022-06-18 15:30:36

Given an integer array `nums`, return _an array_ `answer` _such that_ `answer[i]` _is equal to the product of all the elements of_ `nums` _except_ `nums[i]`.

The product of any prefix or suffix of `nums` is **guaranteed** to fit in a **32-bit** integer.

You must write an algorithm that runs in `O(n)` time and without using the division operation.

**Example 1:**

**Input:** nums = \[1,2,3,4\]
**Output:** \[24,12,8,6\]

**Example 2:**

**Input:** nums = \[-1,1,0,-3,3\]
**Output:** \[0,0,9,0,0\]

**Constraints:**

*   `2 <= nums.length <= 105`
*   `-30 <= nums[i] <= 30`
*   The product of any prefix or suffix of `nums` is **guaranteed** to fit in a **32-bit** integer.

**Follow up:** Can you solve the problem in `O(1)` extra space complexity? (The output array **does not** count as extra space for space complexity analysis.)

**SOLUTION:**

    class Solution:
        def productExceptSelf(self, nums: List[int]) -> List[int]:
            n = len(nums)
            lc = 1
            lp = [lc]
            rc = 1
            rp = [rc]
            for i in range(n):
                lc *= nums[i]
                lp.append(lc)
                rc *= nums[n - i - 1]
                rp.append(rc)
            return [lp[i] * rp[n - i - 1] for i in range(n)]
CSS: Untitled UI logo
Tags: tutorial, css, webdev
Published: 2022-06-18 15:03:56

While looking for inspiration for a new project, I came across the Untitled UI logo and decided to write it in CSS. 


![Untitled UI logo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nqnni7ckpsb9fl0thia7.png)

```html
<div class="logo" style="--width: 20rem"></div>
```

```scss
.logo {
  width: var(--width);
  height: calc(var(--width) / 2);
  background-color: hsl(258, 51%, 50%);
  border-radius: 100vmin 100vmin 0 0;
  position: relative;

  &::before {
    content: "";
    width: 100%;
    height: 100%;
    position: absolute;
    bottom: -100%;
    transform: rotate(180deg);
    background-color: hsl(258, 51%, 50%);
    border-radius: 100vmin 100vmin 0 0;
  }

  &::after {
    content: "";
    width: 150%;
    height: 150%;
    position: absolute;
    bottom: -150%;
    left: -25%;
    border-radius: 100vmin 100vmin 0 0;
    transform: rotate(180deg);
    background-color: hsla(228, 26%, 96%, 0.1);
    backdrop-filter: blur(calc(var(--width) / 10));
  }
}
```
Queens That Can Attack the King
Tags: leetcode, dsa, theabbie
Published: 2022-06-18 15:00:48

On an **8x8** chessboard, there can be multiple Black Queens and one White King.

Given an array of integer coordinates `queens` that represents the positions of the Black Queens, and a pair of coordinates `king` that represent the position of the White King, return the coordinates of all the queens (in any order) that can attack the King.

**Example 1:**

![](https://assets.leetcode.com/uploads/2019/10/01/untitled-diagram.jpg)

**Input:** queens = \[\[0,1\],\[1,0\],\[4,0\],\[0,4\],\[3,3\],\[2,4\]\], king = \[0,0\]
**Output:** \[\[0,1\],\[1,0\],\[3,3\]\]
**Explanation:**  
The queen at \[0,1\] can attack the king cause they're in the same row. 
The queen at \[1,0\] can attack the king cause they're in the same column. 
The queen at \[3,3\] can attack the king cause they're in the same diagnal. 
The queen at \[0,4\] can't attack the king cause it's blocked by the queen at \[0,1\]. 
The queen at \[4,0\] can't attack the king cause it's blocked by the queen at \[1,0\]. 
The queen at \[2,4\] can't attack the king cause it's not in the same row/column/diagnal as the king.

**Example 2:**

**![](https://assets.leetcode.com/uploads/2019/10/01/untitled-diagram-1.jpg)**

**Input:** queens = \[\[0,0\],\[1,1\],\[2,2\],\[3,4\],\[3,5\],\[4,4\],\[4,5\]\], king = \[3,3\]
**Output:** \[\[2,2\],\[3,4\],\[4,4\]\]

**Example 3:**

**![](https://assets.leetcode.com/uploads/2019/10/01/untitled-diagram-2.jpg)**

**Input:** queens = \[\[5,6\],\[7,7\],\[2,1\],\[0,7\],\[1,6\],\[5,1\],\[3,7\],\[0,3\],\[4,0\],\[1,2\],\[6,3\],\[5,0\],\[0,4\],\[2,2\],\[1,1\],\[6,4\],\[5,4\],\[0,0\],\[2,6\],\[4,5\],\[5,2\],\[1,4\],\[7,5\],\[2,3\],\[0,5\],\[4,2\],\[1,0\],\[2,7\],\[0,1\],\[4,6\],\[6,1\],\[0,6\],\[4,3\],\[1,7\]\], king = \[3,4\]
**Output:** \[\[2,3\],\[1,4\],\[1,6\],\[3,7\],\[4,3\],\[5,4\],\[4,5\]\]

**Constraints:**

*   `1 <= queens.length <= 63`
*   `queens[i].length == 2`
*   `0 <= queens[i][j] < 8`
*   `king.length == 2`
*   `0 <= king[0], king[1] < 8`
*   At most one piece is allowed in a cell.

**SOLUTION:**

    class Solution:
        def isValid(self, x, y):
            if x < 0 or y < 0 or x >= 8 or y >= 8:
                return False
            return True
        
        def queensAttacktheKing(self, queens: List[List[int]], king: List[int]) -> List[List[int]]:
            x, y = king
            queens = set([tuple(q) for q in queens])
            op = []
            for dx, dy in [(1, 0), (1, 1), (0, 1), (-1, 1), (-1, 0), (-1, -1), (0, -1), (1, -1)]:
                n = 1
                while self.isValid(x + n * dx, y + n * dy):
                    if (x + n * dx, y + n * dy) in queens:
                        op.append([x + n * dx, y + n * dy])
                        break
                    n += 1
            return op