teleren/devto huggingface dataset:
962. Maximum Width Ramp
Tags: cpp, programming, algorithms
Published: 2022-03-12 20:55:12

# Description

A **ramp** in an integer array `nums` is a pair `(i, j)` for which `i < j` and `nums[i] <= nums[j]`. The **width** of such a ramp is `j - i`.

Given an integer array `nums`, return *the maximum width of a **ramp** in* `nums`. If there is no **ramp** in `nums`, return `0`.

## Example 1:

```
Input: nums = [6,0,8,2,1,5]
Output: 4
Explanation: The maximum width ramp is achieved at (i, j) = (1, 5): nums[1] = 0 and nums[5] = 5.
```

## Example 2:

```
Input: nums = [9,8,1,0,1,9,4,0,4,1]
Output: 7
Explanation: The maximum width ramp is achieved at (i, j) = (2, 9): nums[2] = 1 and nums[9] = 1.
```

## Constraints:

- `2 <= nums.length <= 5 * 104`
- `0 <= nums[i] <= 5 * 104`

---

# Solutions

## Solution 1

### Intuition

1. build a array to store these index
2. sort these indexes by these numbers in increasing order
    1. if numbers are equal, small index is first
3. from left to right, find min index, and update ans

### Code

```cpp
class Solution {
public:
    int maxWidthRamp(vector<int>& nums) {
        vector<int> idx(nums.size());
        for (int i = 0; i < nums.size(); i++) idx[i] = i;
        sort(idx.begin(), idx.end(), [&](int a, int b) {
            if (nums[a] == nums[b])
                return a < b;
            else
                return nums[a] < nums[b];
        });
        int min_idx = idx[0], res = 0;
        for (int i = 1; i < idx.size(); i++) {
            res = max(res, idx[i] - min_idx);
            min_idx = min(min_idx, idx[i]);
        }
        return res;
    }
};
```

### Complexity

- Time: O(nlogn)
- Space: O(n)
Let's Begin
Tags: beginners, programming, webdev, drupal
Published: 2022-03-12 20:51:04

## Let's Begin!
 
This message is for my future self, and for anyone else who may stumble upon it. Today is the day when I finally got off my butt and stopped talking about creating content, and finally started doing it. At this moment, I am excited about this new path of learning, building, and sharing for anyone who might be lost and would find my content helpful and able to assist them. 

## A Little About Myself

I graduated in December of 2020 with a degree in Computer Information Systems (CIS). After graduation, I secured a role as a web development manager primarily working with Drupal. Before this role, most of my experience was working the front-end with some knowledge of the back-end. Now my new role consists of learning and focusing on all the many different aspects of a website. This includes everything from the design, front-end, back-end, Dev Ops, to everything else that encompasses a fully functioning website.

In some moments it's been a challenge when there is an issue since I am the only one in the web development role for my company. Not having this technical assistance and guidance has pushed me to find different communities and mentors to help assist me with solving, talking, and making sure that I am producing the best code and solutions for my company. 

When I started this position, I knew that if I took everything on by myself it would put me in tough spots, as my career was just beginning. I realize there is no weakness in asking for help and that asking others for help will give you the strength to learn and grow. 

## What Will My Focus Be

My main focus for my content will not be limited to only one topic, rather it will be a blend of all the different topics and problems I will run into. 

To start, most of my content will be revolved around Drupal and all the many things that can go into this powerful CMS. The beauty of working with Drupal is I get the chance to learn and use client-side languages (HTML, CSS, JavaScript) to a server-side language such as PHP. As well as growing my abilities with Mysql, whether that is querying data or managing the health of the database, and learning how to work with 

Although my work is mainly focused on Drupal, my personal projects will not be, and as of right now I am not sure what I want to learn personally. All I know is that I will find, build, and document whatever it is those future projects will be.

## My Goal

Eventually, I want to move into possibly creating videos on my content but I thought written documentation would be the most beneficial for me right now. I believe, spending the time to learn how to document my development issues to my solutions will only help me become a better developer. I hope to help others by providing a possible solution to potentially a similar problem.



Now, what am I going to write about next? 

If you made it this far thank you for reading!
Working with JSON: React
Tags: devops, javascript, react, discuss
Published: 2022-03-12 20:46:35

## This  article should be looking into:

- What is JSON
- Benefits of JSON
- Alternatives to JSON
- Simplifying some funny complexities around JSON
- Practical Applications of JSON in React Projects
- Working with APIs
- and many more...

---

## While waiting, 

What have been your experience in working with JSON? How would you explain JSON to a newbie in JavaScript Coding? What are the areas you would love to have further clarity in using JSON?

---

## Let's discuss!
Goal Setting...
Tags: devjournal, discuss, leadership
Published: 2022-03-12 20:37:50

## Acknowledgement

The resource of this article/material is deeply acknowledged to Sheyan Wahedi. Link in the **resource section**.


---

## Introduction
For effective goal settings, your goals have to be nested in a bigger goal - that is nested in a even bigger one.

The aim of goal seting is to pave the rough road-map that makes you act in alignment with:

- The place you want to go,

- The person you want to become

When you move closer to your goal and ambition, you experience positive emotions.

> I have personally witnessed this experience, most recently in my journey to Truly Understanding React.

Know where you want to go in life and build the skills aligned with that vision. Don't be a short term thinker; think long-term; play for long-term understanding, leadership and satisfaction.

---

## Great Goal Setting Rules.

- **Rule 1**
Your goals have to be aligned within a higher goal, which is nested in your vision or life's purpose.

> In order for me to set a coherent, purposeful, meaningful daily goal, it has to be nested in a long-term goal.

- **Rule 2**: Your goal have to be broken down into manageable pieces. In order to hit a goal, you have to specify it. 


> Not setting goals actually makes you live a life of mediocrity!

- **Rule 3**: Your goals have to be measurable
There are many things to consider if you want to really become more productive, like: eliminating distractions; keeping a clean environment; dealing with and selecting the right friends; dealing with family.

> If you don't have a metric to measure against, there is no way to fail right? Note however, when you set a goal, you automatically have an aim, a target, a focus to succeed!

---

## Actionable tasks

- Set daily goals
- Set weekly goals
- Set monthly goals
- Set Quaterly goals
- Set yearly goals
- set your vision!

---

> Man is a goal-seeking Animal!
> His life only has meaning if he is
> reaching out and striving for his goals.
> Aristotle

---

## Resources
Sheyan Wahedi: https://www.youtube.com/c/ShayanWahedi

## Question:

Do you think planning is different from goal setting, or they actually similar or same? Why?
How to make AWS account without debit/credit card
Tags: aws, s3, node, devops
Published: 2022-03-12 20:33:38

Cloud Computing ☁ is the future of web and internet. There are alot of cloud providers like azure, aws , gcp etc but **AWS** being the most feature rich as well as user friendly. 

But but but.... , to use AWS or say to create account we need credit/debit card from only **Mastercard, Visa, American Express and Discover** Cards. And this limits many of us if we don't held a card among these like _Rupay_ etc. 

But now no more , we can make use of **[Airtel thanks](https://play.google.com/store/apps/details?id=com.myairtelapp&hl=en_IN&gl=US)** App to create account on its _Virtual Bank_ and it provide virtual MasterCard, which further can be used to add while adding account details while registration. 

**Follow these simple steps to create Virtual Bank account:** 🔢

1. First Download the [App](https://play.google.com/store/apps/details?id=com.myairtelapp&hl=en_IN&gl=US)

2. Register on the application using your mobile number (PS : You don't need airtel sim btw). 

3. Create Bank account by navigating to banking tab and perform your KYC steps. 
And Boom 🔥 your account would be activated within short period of time. 
Go on , It's time to create some awesome things 🚀.
 

Follow me on : 🔗 🤝🏻
- [Twitter](https://twitter.com/uttkarsh_581) 
- [Linkedin](https://www.linkedin.com/in/uttkarsh-singh/)

Find more about me at 🌐[theuttkarsh.xyz](www.theuttkarsh.xyz)
Getting Started: An Intro to Josette
Tags: javascript, beginners, career
Published: 2022-03-12 20:14:29

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fd7cgk6tnravmb0m1u3g.jpg)


**Hello, Dev Community**! 
My name is Josette and I’m currently a student of FlatIron’s Software Engineering Flex Program (expected graduation, Aug 2022). I live in Corpus Christi, Texas and work remotely as a Support Manager of a technical support team at a SaaS company. 

I first became interested in software engineering as a career in 2019 after hearing a software engineer present at a company I was working for in Austin, Tx. I was interested in the challenge, the community, and the overall excitement he displayed for his career. I had never considered tech and engineering as something I could just pick up after college. 

After a few months working in my current company, I picked up a bit of knowledge of XML, API, and data servers which piqued my interest further. I attended a few classes at Austin Community College and finally decided to dive into this program at the end of 2020. 

I’m so excited to continue this path and start my career in this industry. Follow along with me as I write about my projects, concepts I’ve found difficult and learned to navigate, and topics I’ve found fun and interesting. 

Thank you for your time!
456. 132 Pattern
Tags: cpp, algorithms, 100daysofcode
Published: 2022-03-12 20:02:19

# Description

Given an array of `n` integers `nums`, a **132 pattern** is a subsequence of three integers `nums[i]`, `nums[j]` and `nums[k]` such that `i < j < k` and `nums[i] < nums[k] < nums[j]`.

Return *`true` if there is a **132 pattern** in `nums`, otherwise, return `false`.*

## Example 1:

```
Input: nums = [1,2,3,4]
Output: false
Explanation: There is no 132 pattern in the sequence.
```

## Example 2:

```
Input: nums = [3,1,4,2]
Output: true
Explanation: There is a 132 pattern in the sequence: [1, 4, 2].
```

## Example 3:

```
Input: nums = [-1,3,2,0]
Output: true
Explanation: There are three 132 patterns in the sequence: [-1, 3, 2], [-1, 3, 0] and [-1, 2, 0].
```

## Constraints:

- `n == nums.length`
- `1 <= n <= 2 * 105`
- `109 <= nums[i] <= 109`

---

# Solutions

## Solution 1

### Intuition

`1, 2, 3, 5, 4, 6, 7`

from right to left, store decreased number(like `7, 6, 4`), if the number (eg. `5`) is not in decreasing order, pop other numbers in stack(which is `4`) and make sure it is monotonic stack, besides record the largest number `num_j`(which is `4`). if find other number(`num_i`) in left smaller than `num_j` return true, otherwise return false

### Code

```cpp
class Solution {
public:
    bool find132pattern(vector<int>& nums) {
        stack<int> stk;
        int num_j = INT_MIN;
        for (int i = nums.size() - 1; i >= 0; i--) {
            if (nums[i] < num_j) return true;
            while (!stk.empty() && nums[i] > stk.top()) {
                num_j = max(num_j, stk.top());
                stk.pop();
            }
            stk.push(nums[i]);
        }
        return false;
    }
};
```

### Complexity

- Time: O(n)
- Space: O(n)
Rust learning resources
Tags: rust, learn
Published: 2022-03-12 19:59:01

---
title: Rust learning resources
published: true
description: Some links about Rust
tags: Rust, Learn
//cover_image: https://raw.githubusercontent.com/rust-lang/rust-artwork/master/logo/rust-logo-64x64.png
---

Here are some links I used (and I'm still using) to learn [Rust](https://www.rust-lang.org/).

[Ultimate Rust Crash Course](https://www.udemy.com/course/ultimate-rust-crash-course/): a great course on Udemy.

_A fast-paced, entertaining, and curiously informative hands-on crash course in the Rust programming language. Who this course is for:_
- _Aspiring systems programmers, software developers, engineers, wizards, warriors, and hobbits_
- _Any developer who needs to run code fast, efficiently, securely, under tight restraints, or with a minimum of bugs._

[Take your first steps with Rust](https://docs.microsoft.com/en-us/learn/paths/rust-first-steps/): free Learning Path on Microsoft Learn.

_Interested in learning a new programming language that's growing in use and popularity? Start here! Lay the foundation of knowledge you need to build fast and effective programs in Rust._

[The Rust Programming Language](https://doc.rust-lang.org/book/): part of the official documentation, also available as paper book on [Amazon.fr](https://www.amazon.fr/gp/product/1718500440/ref=dbs_a_def_rwt_hsch_vapi_tu00_p1_i0). This book is also available with Rust toolchain in: `share/doc/rust/html/book/index.html`.

_Affectionately nicknamed "the book," The Rust Programming Language will give you an overview of the language from first principles. You'll build a few projects along the way, and by the end, you'll have a solid grasp of the language._

[Rust by Example](https://doc.rust-lang.org/rust-by-example/): also part of the official documentation. This one can be found in: `share/doc/rust/html/rust-by-example/index.html`.

_Rust by Example (RBE) is a collection of runnable examples that illustrate various Rust concepts and standard libraries._
Dark Mode in TailwindCSS with JavaScript
Tags: css, tailwindcss, javascript, darkmode
Published: 2022-03-12 19:50:30

For enable dark mode at TailwindCSS you need 3 step of work:

1️⃣ in **tailwind.config.js** file
2️⃣ in **HTMl** file
3️⃣ in **JavaScript** file

For 🔆 & 🌙 icon, **_use Font-Awesome CDN_** 🔗📌 

## Step - 1️⃣
at tailswind.config.js fill add this line of code...

> darkMode: "class",


## Step - 2️⃣ 
add these classes inside your HTML file...

```html
<html lang="en" class="dark">
<head>
    <style>
        .effect {
            transform: rotate(360deg);
        }
    </style>
</head>

<body class="dark:bg-gray-900 dark:text-gray-200">
    
    <div id='themeToggle' class="px-3 py-2 rounded-sm absolute top-4 right-4 cursor-pointer hover:text-orange-400 dark:bg-gray-700 bg-gray-300 ">
        <i class="fas fa-sun text-xl transition ease-linear duration-500"></i>
    </div>

    <script src="./script.js"></script>
</body>
</html>
```


## Step - 3️⃣ 
create & add these code snippet inside your script.js file...

```js
let html = document.querySelector("html");
let themeToggle = document.getElementById('themeToggle');

themeToggle.addEventListener('click', () => {

    themeToggle.children[0].classList.toggle('fa-sun');
    themeToggle.children[0].classList.toggle('fa-moon');
    themeToggle.children[0].classList.toggle('effect');
    html.classList.toggle('dark');  

});
```
Hope its will work at your end... 😎
Happy Codding... 👍
Day 15/100, 100 Days of Code
Tags: javascript, beginners, codenewbie, devjournal
Published: 2022-03-12 19:36:02

Today I finished another online course for advanced objects.

I worked on **Setters** methods. I also learned about **destructuring**, as well as more Built-In object methods.

Going to start another new small project. Looking into something related to weather. After finishing the Pokedex, I'm starting to gain an interest in working with API's.
Learning natural languages, IT way
Published: 2022-03-12 19:15:03

IT related jobs are one of the most interesting and best paid in the world. Unfortunately, these come at a huge cost. Which one? Well, staying up to date with IT news may consume all your time. It also might be not-so-easy to stay mentally healthy using your "numerical" part of the brain all the time.

I have found a way to exercise the “artistic” part of the brain, just to let the "numerical" one get some rest. How? Natural language studies.

OK, “language studies” is a terrific idea, but how can I find time given I work in IT, which means I spend a good chunk of my free time studying IT?

My “magic” answer is… IT meetups in the natural language of your choice.

For example, I am interested in Spanish. I like the language, I like the culture, I like “la comida” :)

I have discovered that Codurance consultancy not only does meetups in English, but also does meetups in Spanish. Joining is easy, attendance is free. Attendees speak Spanish, but you are welcome to ask questions in English. Also, everybody is very friendly and will not go crazy over your grammatical mistakes ;)

Well, now you know my secret. Now there is no “I have nobody to practice with” excuse.

Many thanks to @Ignacio Saporiti. His “Primera kata con Go” meetup last week was absolutely amazing.

You can subscribe to more Codurance meetups (both English and Spanish ones) here: https://www.codurance.com/events/

Many thanks to the @Codurance team for sharing with the community.
2. Anonymous Types
Tags: csharp, turkish
Published: 2022-03-12 18:54:36

Öğrenilecekler : Anonymous Types

## Anonymous Types ne işe yarar ? 

Anonymous Type'lar nesnenin tipini belirtmeden tanımlama yapmanızı(declaration) sağlar. [ayrıca bakınız](https://docs.microsoft.com/en-us/dotnet/csharp/fundamentals/types/anonymous-types)

Örnek : 
```
// Anonymous Types declaration(tanımlaması)
var v = new { Amount = 108, Message = "Hello" };

// Usage Example
Console.WriteLine(v.Amount + v.Message);
```

## Kullanım şekilleri, örnekleri :  

1.) Çoğunlukla linq sorgularında select query'si kullanılır.

Örnek :
```
var productQuery =
    from prod in products
   select new { prod.Color, prod.Price }; // bu satıra dikkat

foreach (var v in productQuery)
{
    Console.WriteLine("Color={0}, Price={1}", v.Color, v.Price);
}
```

2.) Örnek kullanım : 

```
var anonArray = new[] { new { name = "apple", diam = 4 }, new { name = "grape", diam = 1 }};
```
Yukarıda array tanımladık ve tipini belirtmedik.

3.) Diyelimlik tanımladığınız bir anonim tipin (anonymous type) daha sonra değerini değiştirmek istiyorsunuz. Ama bu mümkün değil (çünkü read only). Peki ne yapabiliriz ?

Örnek :

```
var apple = new { Item = "apples", Price = 1.35 };
var onSale = apple with { Price = 0.79 };
Console.WriteLine(apple);
Console.WriteLine(onSale);
```

With diyerek asıl objenin (apple) değerlerinden price'ına yeni değer atayarak onSale objesine atıyoruz.  Dikkat ederseniz apple objesinin değerinde bir değişiklik olmadı (çünkü zaten read only).

4.) Örnek bir kullanım daha, pratik yaparak anlamanız için yazıyorum: 

```
var apple = new { Item = "apples", Price = 1.35 };
var onSale = apple with { Price = 0.79 };
Console.WriteLine(apple);
Console.WriteLine(onSale);
var anonArray = new[] { new { name = apple,versiyon="v1"}, new { name = onSale ,versiyon="v2"} };
Console.WriteLine(anonArray[0]);
Console.WriteLine(anonArray[1]);
```

5.) Örnek bir kullanım daha, pratik yaparak anlamanız için yazıyorum : 

```
List<string> list1 = new List<string>() { "a", "b", "c" };
List<string> list2 = new List<string>() { "c", "d", "e" };


var newList = new[] { list1, list2 }.ToList();
System.Console.WriteLine(newList[0][0]); //a
System.Console.WriteLine(newList[0][1]); //b
System.Console.WriteLine(newList[0][2]); //c
System.Console.WriteLine(newList[1][0]); //c
System.Console.WriteLine(newList[1][1]); //d
System.Console.WriteLine(newList[1][2]); //e
```

[ayrıca bakabilirsiniz](https://stackoverflow.com/questions/612689/a-generic-list-of-anonymous-class)

[ayrıca okuyabilirsiniz](https://www.tutorialsteacher.com/csharp/csharp-anonymous-type)
Some ultimate changes to my chatzoid application
Tags: javascript, webdev, react, firebase
Published: 2022-03-12 18:43:16

- Demo : https://nisabmohd.github.io/chatzoid

- Code : https://github.com/nisabmohd/chatzoid


features:
- Login using Google
- Realtime chat update
- File upload and send
- Create rooms and join with friends
- Logout or switch rooms


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


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/si3nvabhnn71xbff4gxz.png)
Read Excel Files without Interop
Published: 2022-02-28 02:02:03

---
canonical_url: https://ironsoftware.com/csharp/excel/examples/read-excel/
---

IronXL is an Excel Library for C# and .Net which allows developers to Read and edit Excel data from **XLS and XLSX** Documents without using _Microsoft.Office.Interop.Excel_.

The API allows us to Create, Read, Manipulate, Save and Export Excel files intuitively for:

- .Net Framework 4.5+
- .Net Core 2+
- .Net Standard
- Xamarin
- Windows Mobile
- Mono
- & Azure Cloud hosting

IronXL also fully supports ASP.Net, MVC, Windows, MacOS, Linux, iOS, Android and Windows Mobile application development.

**C#:**
```
using IronXL;
using System.Linq;
    
//Supported spreadsheet formats for reading include: XLSX, XLS, CSV and TSV
WorkBook workbook = WorkBook.Load("test.xlsx");
WorkSheet sheet = workbook.WorkSheets.First();
 
//Select cells easily in Excel notation and return the calculated value
int cellValue = sheet["A2"].IntValue;
 
 
// Read from Ranges of cells elegantly.
foreach (var cell in sheet["A2:A10"])
{
    Console.WriteLine("Cell {0} has value '{1}'", cell.AddressString, cell.Text);
}
 
//Calculate aggregate values such as Min, Max and Sum
decimal sum = sheet["A2:A10"].Sum();
 
 
//Linq compatible
decimal max = sheet["A2:A10"].Max(c => c.DecimalValue);
```

**VB:**
```
Imports IronXL
Imports System.Linq
 
'Supported spreadsheet formats for reading include: XLSX, XLS, CSV and TSV
Private workbook As WorkBook = WorkBook.Load("test.xlsx")
Private sheet As WorkSheet = workbook.WorkSheets.First()
 
'Select cells easily in Excel notation and return the calculated value
Private cellValue As Integer = sheet("A2").IntValue
 
 
' Read from Ranges of cells elegantly.
For Each cell In sheet("A2:A10")
	Console.WriteLine("Cell {0} has value '{1}'", cell.AddressString, cell.Text)
Next cell
 
'Calculate aggregate values such as Min, Max and Sum
Dim sum As Decimal = sheet("A2:A10").Sum()
 
 
'Linq compatible
Dim max As Decimal = sheet("A2:A10").Max(Function(c) c.DecimalValue)
```