CᴏᴅɪɴɢNᴇʀᴅ 💸🐾
99 subscribers
118 photos
3 videos
15 files
40 links
༗ हरे कृष्णा ༗
"Lost in my own cosmos 💫 | Coding Need Patience 🥀🐾"

❝Face the failure, Until the Failure fails to face you.❞

— Dreamer

» ChikuX69.netlify.app «

DM ? " @ChikuXBot " : 404;
Download Telegram
Day 06 👾:
Given an array arr[] consisting of n integers, the task is to find all the array elements which occurs more than floor(n/3) times.

Note: The returned array of majority elements should be sorted.
🔥3👏3
Creating Virtual Environment for Python

» Download Python
First you need python installed in your local machine to create virtual environment.
Download Python from Here



» Steps to create '.env' folder (virtual environment for python)
1. Navigate to the folder where you want to make your project
Example:

cd D:/code/


2. Open terminal (local terminal, command prompt, or vs code terminal) in that folder

3. Now, use these commands
python --version # Type this and hit enter to verify the python version


# Now use these commands
python -m venv .env


4. Your virtual environment is created in that folder, now activate this virtual environment using this command.

Command for 'Command Prompt':
.\env\Scripts\activate


Command for 'Powershell':
.\env\Scripts\Activate.ps1


Command for Git Bash or WSL:
source \.env\bin\activate


If Powershell gives you error like File cannot be loaded because running scripts is disabled then use this command!
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass


5. Congratulations🎊 Your virtual environment activated now make your project


Happy Coding 👨‍💻
🐳31👍1🕊1
Day 07 👾:
Q. Stock Buy and Sell - Multiple Transaction Allowed (Hard)

Given an array prices[] of size n denoting the cost of stock on each day, the task is to find the maximum total profit if we can buy and sell the stocks any number of times.

Note: We can only sell a stock which we have bought earlier and we cannot hold multiple stocks on any day.
3🔥3
Day 08👾:
Given an array prices[] of length n, representing the prices of the stocks on different days. The task is to find the maximum profit possible by buying and selling the stocks on different days when at most one transaction is allowed. Here one transaction means 1 buy + 1 Sell. If it is not possible to make a profit then return 0.

Note: Stock must be bought before being sold.
👍2🐳2👏1🕊1
» Image Captcha Generator 👨‍💻

Let's make a image captcha generator using python.
You can use it in your website or in telegram bots for user verifications, it generate random text in image so that bots can be recognize..


1. At first create virtual environment for your project (This is more convenient when you building a project, it provides an isolated space from your default local machine's python interpreter.

If you don't know how to make virtual environment, Follow This Post


2. Now let's install libraries that we need
pip install captcha pillow


3. Let't Write code for our image captcha
from captcha.image import ImageCaptcha
from io import BytesIO
from PIL import Image
import string, random

def random_text():
text = string.ascii_letters + string.digits
f_text = ''
for i in range(6):
f_text += random.choice(text)
return f_text

def image_captcha(text: str) -> None:
captcha: ImageCaptcha = ImageCaptcha(width=400, height=200, font_sizes=(50, 70, 100))

data: BytesIO = captcha.generate(text)
image: Image = Image.open(data)
image.show('Temp')


if __name__ == '__main__':
image_captcha(random_text())


Run Code and test yourself

@NotCoding | @CodesSnippet

Happy Coding 👨‍💻
🔥2👏21🐳1
Sample image of captcha generator code
👏2🐳2🔥1
Day 09👾:
Given the heights of n towers and a positive integer k, increase or decrease the height of all towers by k (only once). After modifications, the task is to find the minimum difference between the heights of the tallest and the shortest tower.
🔥4👍2
Day 10👾:
Given an array arr[], the task is to find the subarray that has the maximum sum and return its sum.
👏3🔥2
Day 11👾:
Given an array arr[] that contains positive and negative integers (may contain 0 as well). Find the maximum product that we can get in a subarray of arr[].

Note: It is guaranteed that the output fits in a 32-bit integer.
🔥32👍1
Day 12👾:
Given an array of integers arr[] in a circular fashion. Find the maximum subarray sum that we can get if we assume the array to be circular.
👍3🔥1👏1💋1
° Setup and install Tailwindcss °

→ To setup and install Tailwindcss in your local machine (pc), you need to follow some steps!!


→ At first to install Tailwindcss you need nodejs installed in your pc, let's intsall nodejs first..
› To install nodejs visit official website of nodejs, download latest version and install it simply by running that executable file.

› If you have Mac or linux then go to Official website and choose nodejs for your machine.

> Verify installation by running command: node -v


→ Now node is installed in your pc now we will install Tailwindcss, follow the steps
1. Go to folder where you want to make your project. (You can also install it directly by terminal.)
Example:
cd D:/code/ 


2. Right-click and open in terminal or open that folder in vs code and open terminal there.

3. Install Tailwindcss.
npm install -D tailwindcss


4. Initalize Tailwind for your project (run this command in that directory where you want to setup and develop your project).
npx tailwindcss init


5. You will see tailwind.config.js named file is created, you need to edit it. Open that file you will see some code (keep it for now let's create some folder first).

6. Create 2 folders named dist and src, in src folder create a file named input.css and write this code in this file.
@tailwind base;
@tailwind components;
@tailwind utilities;


7. And in dist folder your all project file will placed make their index.html and style.css.
8. Now edit that tailwind.config.js mentioned in step 5. Edit Content property in this file.
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ["./dist/*.html"],
theme: {
extend: {},
},
plugins: [],
}


9. Now run this code in terminal (This will work as live server for tailwindcss).
npx tailwindcss -i ./src/input.css -o ./dist/style.css --watch


10. Now Tailwindcss installed and now u can write your html code. You don't need to edit style.css just write code in html file. For more visit official website of tailwindcss and read docs.

@NotCoding | @CodesSnippet

Happy Coding 👨‍💻
🔥211👍1👏1
Day 13👾:
You are given an integer array arr[]. Your task is to find the smallest positive number missing from the array.

Note: Positive number starts from 1. The array can have negative integers too.
🔥3👏2👍1
» Random Password Generator using Tailwind

Random Password Generator is a web application that allows users to create secure passwords based on their preferences. It is built using HTML, TailwindCSS, and JavaScript.


NOTE: To setup Tailwindcss in your pc follow these instructions.


› Here's HTML Code of it.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Random Password</title>
<link rel="stylesheet" href="style.css">
<link rel="shortcut icon" href="icon.png" type="image/x-icon">
</head>
<body class="p-0 m-0 h-[100vh] w-full grid place-content-center justify-items-center place-items-center text-white bg-blue-400">
<div class="bg-slate-400 h-[95vh] w-[97vw] rounded-2xl flex justify-center items-center">
<div class="bg-slate-600 h-[18rem] w-[25rem] rounded-xl border-b-black p-2 text-center">
<h1 class="font-extrabold font-serif mt-1 select-none cursor-default">
Random Password Generator
</h1>
<div class="h-fit flex justify-center items-center flex-col border-black border-2 m-5 rounded-xl">
<div class="p-2 h-[4rem] border border-black w-[95%] mt-2 rounded-t-xl rounded-b-md flex justify-center items-center">
<code id="pass-gen" class="select-none"></code>
</div>
<div class="mt-1 mb-2 rounded-b-xl rounded-t-md p-2 w-[95%] h-fit border-black border cursor-pointer active:scale-95 hover:bg-gray-500 hover:border-green-300 transition duration-200 ease-in-out" id="copy-item">
<h2 class="font-semibold font-sans select-none">
Copy
</h2>
</div>
</div>
<div class="flex justify-center items-center m-2 select-none">
<div class="px-2 cursor-pointer select-none">
<input type="checkbox" name="Alphabet" id="alphabets" class="cursor-pointer">
<label for="alphabets" class="cursor-pointer select-none">Alphabets</label>
</div>
<div class="px-2 cursor-pointer select-none">
<input type="checkbox" name="Numbers" id="numbers" class="cursor-pointer">
<label for="numbers" class="cursor-pointer select-none">Numbers</label>
</div>
<div class="px-2 cursor-pointer select-none">
<input type="checkbox" name="Symbols" id="symbols" class="cursor-pointer">
<label for="symbols" class="cursor-pointer select-none">Symbols</label>
</div>
</div>
<div class="flex justify-center items-center">
<div class="h-fit w-[90%] p-2 font-bold rounded-3xl bg-green-600 cursor-pointer text-black select-none active:scale-95 hover:bg-green-500 transition duration-200 ease-in-out" id="generate-button">
Generate
</div>
</div>
</div>
</div>
<script src="script.js"></script>
</body>
</html>


• For Full Code Here
• Demo Website is Here


@NotCoding | @CodesSnippet

Happy Coding 👨‍💻
👍2🔥2🫡2👏1
Day 14👾:
Given a string s, the objective is to convert it into integer format without utilizing any built-in functions. Refer the below steps to know about atoi() function.

Cases for atoi() conversion:

1. Skip any leading whitespaces.
2. Check for a sign (‘+’ or ‘-‘), default to positive if no sign is present.
3. Read the integer by ignoring leading zeros until a non-digit character is encountered or end of the string is reached. If no digits are present, return 0.
4. If the integer is greater than 2**31 – 1, then return 2**31 – 1 and if the integer is smaller than -231, then return -231.
👍4🔥3
Day 15👾:
Given two binary strings s1 and s2 consisting of only 0s and 1s. Find the resultant string after adding the two Binary Strings.
Note: The input strings may contain leading zeros but the output string should not have any leading zeros.
3👍2👏2
° Telegram Formatting °

Telegram supports text formatting in messages using Markdown or HTML. This allows you to style your messages with bold, italic, links, inline code, and more.


› Formatting in HTML


1. Bold
<b>Bold Text</b>


<strong>bold</strong>


2. Italic
<i>Italic Text</i>


<em>italic</em>


3. Underline
<u>Underline Text</u>


4. Monospace
<code>Monospace Text<code>


5. Spoiler
<spoiler>Spoiler Text</spoiler>


6. Strikethrough
<s>Strikethrough Text</s>


<strike>strike</strike>


<del>strike</del>


7. URL or Link
<a href="https://telegram.me/NotCoding">text URL</a>


8. Inline Mention
<a href="tg://user?id=5217486447">inline mention</a>


9. Emoji
<emoji id="123456789abcdef">🐱</emoji>


10. Pre Formatted
<pre>pre-formatted</pre>


11. Pre Formatted(Specified Language)
<pre language="python">pre-formatted</pre>


12. Quote or Blockquote
<blockquote>Quoted text</blockquote>


@NotCoding | @CodesSnippet

Happy Coding 👨‍💻
🔥2🐳21🌚1
Day 16👾:
Given two strings s1 and s2 consisting of lowercase characters. The task is to check whether two given strings are an anagram of each other or not. An anagram of a string is another string that contains the same characters, only the order of characters can be different. For example, "act" and "tac" are an anagram of each other. Strings s1 and s2 can only contain lowercase alphabets.

Note: You can assume both the strings s1 & s2 are non-empty.
🔥4👍2
° Telegram Formatting °

Telegram supports text formatting in messages using Markdown or HTML. This allows you to style your messages with bold, italic, links, inline code, and more.


Formatting in HTML


› Formatting in MARKDOWN


1. Bold
**bold**


2. Italic
__italic__


3. Underline
--underline--


4. Monospace
`inline fixed-width code`


5. Spoiler
||spoiler||


6. Strikethrough
~~strike~~


7. URL or Link
[text URL](https://telegram.me/NotCoding)


8. Inline Mention
[text user mention](tg://user?id=5217486447)


9. Pre Formatted
```
pre-formatted```


10. Quote or Blockquote
> Quoted text


@NotCoding | @CodesSnippet

Happy Coding 👨‍💻
👍2🔥2🕊2👏1
Day 17👾:
Given a string s consisting of lowercase Latin Letters. Return the first non-repeating character in s. If there is no non-repeating character, return '$'.
Note: When you
return '$' driver code will output -1.
🔥3👍2👏1
All the best to me 😂
Exam Time 🫠 17 Dec - 20 Dec
🔥2🗿2👍1🥰1😢1