teleren/devto huggingface dataset:
Reverse Integer Algorithm in C++, Java, and Python - LeetCode Problem
Tags: programming, algorithms, leetcode, beginners
Published: 2023-09-09 03:32:31

Reverse Integer is medium level problem of LeetCode. In this post, we will see the solution of this problem in C++, Java, and Python.

## Problem Statement and Explanation

Given a signed 32-bit integer x, return x with its digits reversed. If reversing x causes the value to go outside the signed 32-bit integer range `-2 **31`, `2** 31 - 1`, then return 0.

### Example 1:

```
input: 134
output: 431

```

### Example 2:

```
input: -312
output: -213

```

## Reverse Integer Python Solution in Python
{% gist https://gist.github.com/codeperfectplus/a367c7c4a108f32c97c3fc564b92bd97.js %}
## Reverse Integer Java Solution in Java
{% gist https://gist.github.com/codeperfectplus/90c9aaebd77b8e122c57e3a6129e7040.js %}
## Reverse Integer C++ Solution in C++
{% gist https://gist.github.com/codeperfectplus/f9b93b29c4f32a748d1533af8266c911.js %}

## Explanation of Solution

- The while loop iterates until the number x is 0.
- In each iteration, the function pops the last digit off the number x and stores it in the variable pop.
- The number x is then divided by 10.
- The function checks if the reversed number rev is greater than INT\_MAX or less than INT\_MIN. If it is, the function returns 0.
- The reversed number rev is then multiplied by 10 and the last digit pop is added back.
- The function returns the reversed number rev.

## Time Complexity of the Solution

The time complexity of the solution is O(n), where n is the number of digits in the original number. This is because the while loop iterates n times.

Here is a breakdown of the time complexity of each step in the function:

- The while loop iterates n times.
- The pop operation takes constant time.
- The x //= 10 operation takes constant time.
- The if statement takes constant time.
- The rev = rev \* 10 + pop operation takes constant time.
- Therefore, the total time complexity of the function is O(n).

## Space Complexity of the Solution

The space complexity of the solution is O(1), since the function only uses a constant number of variables. Here is a breakdown of the space complexity of each step in the function:

- The rev variable is a local variable and only needs to be stored on the stack.
- The pop variable is a local variable and only needs to be stored on the stack.
- The if statement does not introduce any new variables.
- Therefore, the total space complexity of the function is O(1).

_Problem statement is taken from [Leet Code](https://leetcode.com/problems/reverse-integer/), and the solutions are implemented by **CodePerfectPlus** team._
The Minion Game - HackerRank Solution Python
Tags: python, algorithms, beginners, coding
Published: 2023-09-09 03:31:03

The Minion Game is an interesting medium level problem in Python. In this post, we will see the solution of The Minion Game in Python.

## Problem Statement and Explanation

Kevin and Stuart have decided to play a game called ‘The Minion Game’. The game has some rules that they both must follow.

Here are the rules:

- Both players will receive the exact same string.
- Using the letters from the string, both players must create as many substrings as possible.
- Stuart can only create words that start with consonants.
- Kevin can only create words that start with vowels.
- The game ends when both players have created all possible substrings.

### Input Format

- A single line of input containing the string S.

### Output Format

Return one of the following strings based on the winner:

- If Stuart wins, return Stuart followed by the score separated by a space.
- If Kevin wins, return Kevin followed by the score separated by a space.

## The Minion Game Python Solution
{% gist https://gist.github.com/codeperfectplus/cf4b40a083e70583f339f2dc02f0f8f4.js %}

## Explanation of Solution

- The function first defines a list of vowels, vowels.
- It then declares two variables, stuart\_score and kevin\_score, to keep track of the scores of the two players.
- The for loop iterates over the characters in the string.
- In each iteration, the function checks if the current character is a vowel.
- If it is, the function adds the length of the string minus the index of the character to kevin\_score.
- Otherwise, the function adds the length of the string minus the index of the character to stuart\_score.
- The if statement checks which player has the higher score.
- If stuart\_score is higher, the function prints Stuart followed by the value of stuart\_score.
- If kevin\_score is higher, the function prints Kevin followed by the value of kevin\_score.
- If the scores are equal, the function prints Draw.

## Time Complexity of the Solution

The for loop in the minion\_game function iterates over the characters in the string. The number of characters in the string is n, so the for loop takes n iterations. Each iteration takes constant time, so the overall time complexity of the function is O(n).

## Space Complexity of the Solution

The minion\_game function only uses two variables, stuart\_score and kevin\_score. These variables are of constant size, so the overall space complexity of the function is O(1).

_Problem statement is taken from [Hackerrank](https://www.hackerrank.com/domains/python), and the solutions are implemented by **CodePerfectPlus** team_

## Other Article By Author

- [HackerRank Solve Python Algorithm Series](https://codeperfectplus.com/category/Solve-python)
- [HackerRank Problem Solving Algorithm Series](https://codeperfectplus.com/category/Problem-solving)
- [30 Days of Code HackerRank](https://codeperfectplus.com/category/Hackerank-30-days-of-code)
- [10 Days of JavaScript HackerRank](https://codeperfectplus.com/category/10-days-of-javascript)

### [30 Days of Code SubReddit](https://www.reddit.com/r/30daysofcode)
mPDF Bangla font not working/Bangla font break in Laravel Fix
Tags: mpdf, laravel, bangla, issuefix
Published: 2023-09-09 03:30:33

I am using laravel 9 Here. Hope this will work for other versions in the same way. 

Since you're in the process of troubleshooting issues, I presume that you have already installed mPDF within your Laravel project. 

> If not [CLICK ON THE LINK](https://github.com/mccarlosen/laravel-mpdf) and follow the steps

Now you have to publish your `config/pdf.php` file of mPdf. Run this command on terminal from your project path.

```
php artisan vendor:publish --tag=mpdf-config
```
Then, go to the file using your code editor. then add/replace this in the return array-

```
'custom_font_dir'          => base_path('resources/fonts/'),
'custom_font_data'         => [
        'kalpurush' => [
            'R'  => 'Kalpurush.ttf',
            'B'  => 'Kalpurush.ttf',
            'I'  => 'Kalpurush.ttf',
            'BI' => 'Kalpurush.ttf'
            ]
        ],
'auto_language_detection'  => true,
```
Now download `kalpurush.ttf` file from internet source. Then place that file on this directory -

> Note: You can use any other font you like. just make sure you are using the file name correct.

```
resources/fonts/kalpurush.ttf
```
Now go to your pdf blade file and add this on style
```
body {
        font-family: sans-serif,'Kalpurush';
        font-size: 12px
      }
```

I used this on controller

```
use PDF; // Used on top

    public function setupQuestionPost(QuestionGenerateHeadStoreRequest $request){
         ...
         ...

        $data = [
            'demo' => 'demo text',
        ];

        $pdf = PDF::loadView('backend.pdf.question_pdf', compact('data'));

        return $pdf->stream('document.pdf');
    }
```

Thanks For reading. Hope this will Help you.
Web Developer !== Designer
Tags: beginners, webdev
Published: 2023-09-09 03:29:15

If you're reading this, you most likely asked something along the lines of "I want to be a web-developer but don't think I have an eye for design, can I still make it in this field?". The simple answer? Of course you can.

I've spent enough time in The Odin Project's [discord](https://discord.com/invite/fbFCkYabZBhttps://discord.com/invite/fbFCkYabZB), to see this asked plenty of times. And every time myself, or another person will go ahead and tell them how it is. **As a web developer, you do not need to be a good designer or even know anything about design.** Of course, if you knew design principles and thats something you are good at, it is not a bad thing. But if your goal is to be a web developer, you will simply be wasting time looking for other resources that are teaching you design.

Let's say you finally completed [The Odin Project](https://www.theodinproject.com/paths), and get yourself a job as a web developer. There is an _extremely high_ chance that your job will have also hired designers. Woooohoooo! You now get paid to implement their designs and don't have to think about creating your own anymore.

I do understand though, that throughout your self-directed learning there will be many projects that don't have a clear outlined design and you are going to have to create your own. 

Here is some general advice if you struggle with thinking of designs and making your projects "look good":
- Find an online resource that can generate a good color palette for your project. My favorite is: https://coolors.co/
- Remember sometimes the simpler, the better
- Get inspiration from other people's projects (but make sure not to copy them)
- Look up real world examples of the project and see what you like about them. 
- Lastly, don't sweat if your project doesn't look amazing. 

_**Just remember the job of a web developer is to code, not draw up designs.**_
Nạp sạc bình chữa cháy tại Quận Gò Vấp uy tín, chất lượng
Tags: thienbang, napbinhchuachaygovap, news
Published: 2023-09-09 02:49:46

Chuyên nạp sạc bình chữa cháy tại Quận Gò Vấp với giá thành cực tốt, uy tín hàng đầu, bảo hành 6 tháng…
Cùng với sự tăng nhanh về kinh tế, Quận Gò Vấp hiện nay mọc lên khá nhiều công trình như: các trường học, khu công nghiệp, . .. Song song với đó là các rủi ro cháy nổ, những tệ nạn tăng cao.

Đối với các doanh nghiệp, thì nhà xưởng, xí nghiệp, khu công nghiệp được xem là những tài sản quý giá nhất. Nhưng, đây cũng là nơi nguồn tài sản dễ dàng bị phá huỷ và hư hỏng nhất do nhiều yếu tố như thiên tai, cơn bão, hỏa hoạn, lũ lụt nhưng nguyên nhân chính nhiều nhất là do cháy, nổ.

Ngoài ra, cháy nổ không chỉ gây tổn thất về mặt vật chất, nó cũng có thể tạo ra các tác hại không ngờ đối với sức khoẻ của con người. Việc nạp sạc bình chữa cháy nhằm đảm bảo luôn có dụng cụ dự trữ phòng chống cháy nổ thật sự là việc vô cùng quan trọng.

## Quy trình Nạp sạc bình chữa cháy tại Quận Gò Vấp:

Với đội ngũ nhân viên chuyên môn cao, nhiều kinh nghiệm tận tình,hỗ trợ chu đáo khi nạp sạc [bình chữa cháy tại Quận Gò Vấp](https://bcc.thienbang.com/ban-binh-chua-chay-go-vap-mua-o-dau-co-tem-kiem-dinh-gia-tan-goc/), quý khách hàng sẽ có những sự chọn lựa hợp lý nhất về giá cả và chất lượng dịch vụ đảm bảo về chất lượng theo quy trình sau:
+ Sau khi kiểm tra đã nhận bình chữa cháy, bình cứu hoả, thiết bị PCCC từ phía khách. 

+ Nhân viên kỹ thuật sẽ mang tới công ty để kiểm tra vệ sinh và loại bỏ các chất chữa cháy cũ trong bình cứu hoả. Sau đó kiểm tra coi có bộ phận, phụ tùng nào hỏng hóc không cần thay thế và Nạp sạc bình chữa cháy mới.

+ Ngoài ra, nhân viên kỹ thuật sẽ kiểm định tình trạng điện áp cùng độ rò của bình cứu hoả thì mới tiến hành chuyển giao tới khách.

Công ty PCCC Thiên Bằng là địa chỉ chuyên nạp sạc bình chữa cháy tại Quận Gò Vấp luôn sẵn sàng phục vụ quý khách, kiểm tra hạn sử dụng, cho đổi bình cứu hoả mới, bảo hành 6 tháng, nhận vận chuyển miễn phí khi quý khách mua đơn hàng lớn. Đảm bảo an toàn theo đúng quy chuẩn kỹ thuật – nạp lại toàn bộ bình cứu hoả khi đã hết hạn hoặc không đáp ứng thông số kỹ thuật với chi phí hợp lý cùng chất lượng bảo đảm.

Nạp sạc bình chữa cháy tại Quận Gò Vấp giá cạnh tranh

Nạp sạc bình chữa cháy tại Quận Gò Vấp. Hãy liên hệ với chúng tôi khi quý khách có nhu cầu kiểm tra thay thế, bảo trì nâng cấp sản phẩm bình chữa cháy, nạp bình chữa cháy, cũng như các dịch vụ sửa chữa thiết bị pccc khác, quý khách nhận được sự hỗ trợ nhiệt tình chu đáo. 
website: [https://bcc.thienbang.com/](https://bcc.thienbang.com/)
Looking forward experience developer
Tags: community, website, developer, copy
Published: 2023-09-09 02:30:08

[]Hello, i want to have a development plan for copy staem with low cost and quickly,it's for my campaign project, could check it here the community: (https://igg.me/at/Ideal4all/x#/[]
The store:(https://igg.me/at/Ideal4CN/x/33681174#/))
Beginning Open Source Development!
Tags: opensource
Published: 2023-09-09 02:04:40

My name is Mingming Ma and I'm very excited to take the Open Source Development course because I think open source projects can offer a great chance to work on real-world software and gain huge practical experience and I believe this course can provide me with valuable insights into how to further enhance my skills.

After this term, my goal is to actively contribute to projects, particularly those with a strong emphasis on front-end development, as I have a keen interest in web development. I'm also intrigued by iOS development, so I'm eager to explore and put in the effort to make progress in that area.

As a result, I've chosen the [ant-design](https://github.com/ant-design/ant-design) project because it aligns perfectly with my interests. It offers documentation in both English and Chinese, which is particularly beneficial for me, allowing me to understand and get started with the project more efficiently, given that I am a Chinese native. More importantly, it's a highly active community, which means I'll have more chances to get involved in the project. I'm eager to dive in and look forward to the learning and challenges ahead!
Here are ten of the most useful shortcuts in VSCode:
Tags: webdev, vscode, javascript
Published: 2023-09-09 01:41:27

1. **Ctrl + D**: Select the next occurrence of the current word. Repeatedly pressing Ctrl + D will select multiple occurrences of the word, making it easy to edit them simultaneously.

2. **Ctrl + /** (Slash): Toggle line comments. This shortcut comments or uncomments the selected lines or the current line.

3. **Ctrl + Shift + L**: Select all occurrences of the current word. This is useful for quickly selecting and editing all instances of a word in a file.

4. **Ctrl + B**: Toggle the sidebar. This shortcut lets you hide or show the file explorer and other sidebars on the left.

5. **Ctrl + Tab**: Cycle through open tabs. Use this shortcut to quickly switch between open files in the editor.

6. **Ctrl + Shift** + F: Open the Find and Replace panel. This allows you to search for text within your project and replace it if needed.

7. **Ctrl + `** (Backtick): Open and close the integrated terminal. This allows you to run terminal commands without leaving VSCode.

8. **Ctrl + P**: Quick Open. This shortcut lets you quickly search for and open files by typing their name. You can also use it to navigate between open files.

9. **Ctrl + Shift + E**: Open the file explorer sidebar. This is handy for quickly navigating and managing your project files.

10. **Ctrl + K**, Ctrl + S: Show Keyboard Shortcuts. This opens a searchable list of all available VSCode keyboard shortcuts, which can help you discover and learn new shortcuts.

## What's your favorite shortcut?
The Beginning of an Open-Source Development Journey
Tags: beginners, webdev, javascript
Published: 2023-09-09 01:28:46

Hi there, my name is Mark Marino... I am currently in my 4th and final year as a Software Development student at Seneca Polytechnic. I have a profound passion for both front-end and back-end web development. I am taking this course because I would like to make a meaningful contribution to open source software and gain practical experience with the JavaScript programming language. 

What attracts me to open source development is its flexibility and the open source community working behind the scenes that build and innovate existing software that they're passionate about in an efficient and collaborative manner. In addition, I'd like to collaborate with like minded individuals that are passionate about programming for the same reasons.

The trending Github Repository I researched is [BootStrap](https://github.com/twbs/bootstrap). Bootstraps purpose is to create and maintain a front-end web framework that simplifies web design and development. BootStraps primary objective is to provide developers with a toolkit of responsive and basic customizable UI components. I chose BootStrap as my open source development project because I've used it in the past and it's a widely-used framework that aligns with my interest in JavaScript, and front-end programming. Contributing to Bootstrap allows me to work on a project that impacts web development on a global scale, and provides opportunities for collaboration within a thriving open source community.


This term I am hoping to contribute to an open source web based framework such as React or Angular and their extensions. I am looking forward to merging my first pull request to become an official open source contributor!
🌐 UN Goals : Education & Gender Equity ⚖️
Tags: opendata, jupyter, womenintech, techforgood
Published: 2023-09-09 01:08:56

## ❔ About the 17 Goals

United Nations have identifed [**_17 Goals to Transform Our World_**](https://www.un.org/en/exhibits/page/sdgs-17-goals-transform-world):

{% embed https://www.un.org/sustainabledevelopment/sustainable-development-goals/ %}

Recently I saw this Tweet:

{% twitter 1699875263264227554 %}

that made me wonder how things go in my country.

In this post, I'll focus on the two very specific following ones:

- 🏫 **`Goal 4`** : [Quality Education](https://www.un.org/sustainabledevelopment/education/)
- ⚖️ **`Goal 5`** : [Achieve gender equality](https://www.un.org/sustainabledevelopment/gender-equality/)

... and we'll work on them by focusing on:

- 📍 [New Caledonia](https://www.google.com/maps/d/viewer?mid=1Ek-gvH-GZiDHUfpI8b8IgzckSvY&hl=en&usp=sharing ) country
- 👨‍🎓👩‍🎓 Success rate in scientific high school students [Réussite au baccalauréat](https://data.gouv.nc/explore/dataset/reussite_baccalaureat/information/), thanks to [Open Data](https://data.gouv.nc/)

## 🍿 Demo

{% youtube sqIpfaCUOLQ %}

## 🔖 Related resources

- [🧑‍🎓 Baccalaureat in New-Caledonia on Kaggle](https://www.kaggle.com/adriensales/baccalaureat-in-new-caledonia)
- [Effectifs d’élèves selon le niveau pré-baccalauréat et le genre par lycée](https://data.gouv.nc/explore/dataset/effectifs_eleves_pre_bac_par_lycee/)
- [Effectifs d’élèves selon le niveau et le genre par collège ](https://data.gouv.nc/explore/dataset/effectifs_eleves_par_college/information)
- [Réussite au diplôme national du brevet par collège](https://data.gouv.nc/explore/dataset/reussite_brevet_par_college/)

[![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k1dpxwokq2n43edrkuld.png)](https://www.undp.org/publications/promising-practices-gender-equality)

## 💭 Final thought (Nelson Mandela)

{% twitter 1699995978541961365 %}
JavaScript got 99 problems, but Bun ain't one?
Tags: webdev, javascript, node, typescript
Published: 2023-09-09 00:47:06

I reckon I've come across at least 100 articles discussing JavaScript fatigue over the years. Undoubtedly, for those who have experienced the challenges of upgrading Node versions and dealing with major package version updates, wiring different development, build and testing tools together, the difficulties are undeniable.

However, is there a single solution on the horizon to alleviate all this frustration?

Enter [Bun](https://bun.sh).

Bun is an all-in-one toolkit for JavaScript and TypeScript development, offering fast performance, simplified tooling, and seamless integration. The project has been in development for the last two years, but Bun team just [announced the release of v1.0](https://bun.sh/blog/bun-v1.0). 

Bun serves as a replacement for various existing tools, including Node.js, transpilers, bundlers, package managers, and testing libraries. Bun provides Node.js compatibility, exceptional speed, TypeScript and JSX support, Web API integration, hot reloading, customizable plugins, and optimized standard library APIs. Additionally, Bun functions as a package manager, a bundler with a plugin API, and a test runner with Jest compatibility. It introduces JavaScript macros for bundle-time execution and offers experimental support for Windows. The release marks the beginning of Bun's journey toward new deployment methods for JavaScript and TypeScript.

Sounds pretty awesome if you ask me. But...will it live up to it's promise? 

Maybe, maybe not.

On this [Hacker News thread about the v1.0 release](https://news.ycombinator.com/item?id=37434117), there's some valid comments about the discrepancy between Bun being a "drop-in replacement for Node.js", while also admitting Bun doesn't implement all of Node.js. There is a [page documenting Node.js compatibility](https://bun.sh/docs/runtime/nodejs-apis), but yeah, I kind of agree that a drop-in replacement should ideally come without any exceptions.

Regardless, I'm willing to give it a try. Could Bun be the start of a new era of JS/TS development? Or maybe serve as inspiration and motivation for the Node.js team to bring the now 14 year old runtime to serve the needs of current development? Or will we all be replaced by AI by that time? Only time will tell...
First Blog
Published: 2023-09-09 00:36:39

Hi I am Amir Helali, and I am a fourth year student in the BSD program at Seneca.

I decided to pick the topics in open source course because I can see this course making me a better developer and I can learn about how to work on open source projects. Also, a few my friends who took the course before recommended it because of the content and the prof's (David Humphrey) teachings.

Even though I still need to do more research on what project(s) I want to contribute to and work on, I see this as a great opportunity to learn and to gain experience as a developer. Additionally, contributing to a major open source project is a great addition to my portfolio and experiences in my resume.

I chose MUI which is a huge library of UI components based on Google's material design UI. I chose MUI because most of my experience is as a web developer and I used one of their React templates before in one of my projects. Link: [MUI](https://github.com/mui/material-ui)