GeeksforGeeks
17.4K subscribers
1.83K photos
34 videos
24 files
2.76K links
Official Hub βœ…

Your coding haven – where tech meets simplicity.

Discover:
πŸ˜‚ Coding Laughter
πŸ“˜ Curated Study Material
πŸ’Ž Exclusive Offers

Utilize every service we provide and make a promise to find better opportunities for yourself! #gfgkarlohojayega!
Download Telegram
Must Learn!πŸ’‘
A crucial part of Artificial intelligence is the information needed by humans to develop and train these models in the first place.

This basic cycle of feeding information and how it is fed is Prompt engineering. Learn it in more detail via this article.

Link- https://www.geeksforgeeks.org/what-is-prompt-engineering-the-ai-revolution/?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=airevolution
Problem Of The Day
"Predecessor and Successor"

Solve the problem to win points

There is BST given with the root node with the key part as an integer only. You need to find the in-order successor and predecessor of a given key. If either predecessor or successor is not found, then set it to NULL.

Note:- In an inorder traversal the number just smaller than the target is the predecessor and the number just greater than the target is the successor.

Example 1:
Input:
10
/ \
2 11
/ \
1 5
/ \
3 6
\
4
key = 8
Output:
6 10
Explanation:
In the given BST the inorder predecessor of 8 is 6 and inorder successor of 8 is 10.

Example 2:
Input:
8
/ \
1 9
\ \
4 10
/
3
key = 11
Output:
10 -1
Explanation:
In given BST, the inorder predecessor of 11 is 10 whereas it does not have any inorder successor.

Your Task: You don't need to print anything. You need to update pre with the predecessor of the key or NULL if the predecessor doesn't exist and succ to the successor of the key or NULL if the successor doesn't exist. pre and succ are passed as an argument to the function findPreSuc().

Expected Time Complexity: O(Height of the BST).
Expected Auxiliary Space: O(Height of the BST).

Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/predecessor-and-successor/1

Powered by hirist.com
πŸ‘1
Must Learn!πŸ’‘
If you’re a student or a housewife or a professional who is looking to make money from home without putting too much effort, then you’re at the right place.

Now, it’s more than possible to earn the moolah with the help of AI chatbots, especially ChatGPT or GPT-4. This article explores the ways to make money with ChatGPT. Give it a read-

Link- https://www.geeksforgeeks.org/make-money-with-chatgpt-work-from-home/?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=moneywithchatgpt
🚨Job Alert🚨
AppSuccesor Media is hiring for Web Developer.

Location - NOIDA
Experience - Fresher
Apply by - Jun 30, 2023

Apply via the following link and share the opportunity with your friends- https://www.geeksforgeeks.org/jobs/appsuccesormediapvtltdweb
πŸ‘2
Problem Of The Day
"Least Prime Factor"

Solve the problem to win points

Given a number N, find the least prime factors for all numbers from 1 to N. The least prime factor of an integer X is the smallest prime number that divides it.
Note :

1 needs to be printed for 1.
You need to return an array/vector/list of size N+1 and need to use 1-based indexing to store the answer for each number.

Example 1:
Input: N = 6
Output: [0, 1, 2, 3, 2, 5, 2]
Explanation: least prime factor of 1 = 1,
least prime factor of 2 = 2,
least prime factor of 3 = 3,
least prime factor of 4 = 2,
least prime factor of 5 = 5,
least prime factor of 6 = 2.
So answer is[1, 2, 3, 2, 5, 2].

Example 2:
Input: N = 4
Output: [0, 1, 2, 3, 2]
Explanation: least prime factor of 1 = 1,
least prime factor of 2 = 2,
least prime factor of 3 = 3,
least prime factor of 4 = 2.
So answer is[1, 2, 3, 2].

Your Task:
You don't need to read input or print anything. Complete the function leastPrimeFactor() which takes N as input parameter and returns a list of integers containing all the least prime factors of each number from 1 to N.

Expected Time Complexity: O(NlogN)
Expected Auxiliary Space: O(N)

Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/least-prime-factor5216/1

Powered by hirist.com
πŸ‘1
Must Learn!πŸ’‘
A collection of technologies known as artificial intelligence (AI) enables computers to carry out a range of complex tasks, such as the ability to see, hear, interpret, and translate spoken and written language, analyze data, generate suggestions, and more.

Now, let us see the different classifications of artificial intelligence on the basis of its functionality in the following section.

In this article, discuss the top 20 artificial intelligence applications with examples.

Link- https://www.geeksforgeeks.org/artificial-intelligence-applications/?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=artificialintellegenceapplications
Problem Of The Day
"Find Kth permutation"

Solve the problem to win points

Given two integers N (1<=N<=9) and K. Find the kth permutation sequence of first N natural numbers. Return the answer in string format.

Example 1:
Input: N = 4, K = 3
Output: 1324
Explanation:
Permutations of first 4 natural numbers:
1234,1243,1324,1342,1423,1432.....
So the 3rd permutation is 1324.

Example 2:
Input: N = 3, K = 5
Output: 312
Explanation:
Permutations of first 3 natural numbers:
123,132,213,231,312,321.
So the 5th permutation is 312.

Your Task:
You don't need to read input or print anything. Your task is to complete the function kthPermutation() which takes two integers N and K as input parameters and returns a string denoting the kth permutation.

Expected Time Complexity: O(N2)
Expected Auxiliary Space: O(N)

Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/find-kth-permutation-0932/1

Powered by hirist.com
❀1
Must Learn!πŸ’‘
In the year 2023, it is very easy to build a TO-DO app with the help of ChatGPT.

In this article, we will make a TODO app with ChatGPT. The TODO app is generally used to track our daily goals and the work we need to do on a daily basis. So, give this article a read-

Link- https://www.geeksforgeeks.org/how-to-build-a-to-do-app-with-chatgpt/?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=chatgpt
πŸ‘1
🚨Job Alert🚨
Alphaware is hiring for Java Developer.

Location - Mumbai
Experience - Internship
Apply by - Jul 05, 2023

Apply via the following link and share the opportunity with your friends- https://www.geeksforgeeks.org/jobs/alphaware-javadev?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=alphawarejavadev
Problem Of The Day
"Permutations of a given string"

Solve the problem to win points

Given a string S. The task is to print all unique permutations of the given string in lexicographically sorted order.

Example 1:
Input: ABC
Output:
ABC ACB BAC BCA CAB CBA
Explanation:
Given string ABC has permutations in 6
forms as ABC, ACB, BAC, BCA, CAB and CBA .

Example 2:
Input: ABSG
Output:
ABGS ABSG AGBS AGSB ASBG ASGB BAGS
BASG BGAS BGSA BSAG BSGA GABS GASB
GBAS GBSA GSAB GSBA SABG SAGB SBAG
SBGA SGAB SGBA
Explanation:
Given string ABSG has 24 permutations.

Your Task:
You don't need to read input or print anything. Your task is to complete the function find_permutaion() which takes the string S as input parameter and returns a vector of string in lexicographical order.

Expected Time Complexity: O(n! * n)
Expected Space Complexity: O(n! * n)

Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/permutations-of-a-given-string2041/1

Powered by hirist.com
Must Learn!πŸ’‘
Backlink is a hyperlink on another website that, when clicked, directs users to a specific page on your website.

They are an important part of search engine optimization (SEO) because they can help improve a website’s ranking in search engine results pages (SERPs).

Backlinks indicate that other websites find your content valuable enough to link to it, which can lead to increased visibility, organic traffic, and trust for your website.

For detailed information, read the following article- https://www.geeksforgeeks.org/how-to-get-backlinks-for-your-website/?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=backlinks
πŸ‘4
Problem Of The Day
"Arranging the array"

Solve the problem to win points

You are given an array of size N. Rearrange the given array in-place such that all the negative numbers occur before all non-nagative numbers.(Maintain the order of all -ve and non-negative numbers as given in the original array).

Example 1:
Input:
N = 4
Arr[] = {-3, 3, -2, 2}
Output:
-3 -2 3 2
Explanation:
In the given array, negative numbers
are -3, -2 and non-negative numbers are 3, 2.

Example 1:
Input:
N = 4
Arr[] = {-3, 1, 0, -2}
Output:
-3 -2 1 0
Explanation:
In the given array, negative numbers
are -3, -2 and non-negative numbers are 1, 0.

Your Task:
You don't need to read input or print anything. Your task is to complete the function Rearrange() which takes the array Arr[] and its size N as inputs and returns the array after rearranging with spaces between the elements of the array.
Expected Time Complexity: O(N. Log(N))
Expected Auxiliary Space: O(Log(N))

Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/arranging-the-array1131/1

Powered by hirist.com
Must Learn!πŸ’‘
Lead Generation tools are software applications that help businesses identify and capture potential customers’ contact information, such as their email addresses, phone numbers, and social media profiles.

These tools automate the process of generating leads, making it easier and faster for businesses to build their customer base.

Learn about the tools in detail, click on the following link- https://www.geeksforgeeks.org/top-lead-generation-tools/?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=topleadgenerationtools
🚨Job Alert🚨
Brainstorm Force is hiring for Front End Developer.

Location - Remote
Experience - 1 - 6 Years
Apply by - Jun 22, 2023

Apply via the following link and share the opportunity with your friends- https://www.geeksforgeeks.org/jobs/brainstormforce-frontend-developer-3510?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=frontenddeveloper
πŸ‘6
Problem Of The Day
"Adding Ones"

Solve the problem to win points

Today's Problem! Apply For Mega Job-A-Thon

You start with an array A of size N. Initially all elements of the array A are zero. You will be given K positive integers. Let j be one of these integers, you have to add 1 to all A[i], where i β‰₯ j. Your task is to print the array A after all these K updates are done.
Note: 1-based indexing is used everywhere in this question.

Example 1:

Input:
N = 3, K = 4
1 1 2 3
Output:
2 3 4
Explanation:
Initially the array is {0, 0, 0}. After the
first 1, it becomes {1, 1, 1}. After the
second 1 it becomes {2, 2, 2}. After 2,
it becomes {2, 3, 3} and
After 3 it becomes, {2, 3, 4}.

Example 2:

Input:
N = 2, K = 3
1 1 1
Output:
3 3
Explanation:
Initially the array is {0, 0}. After the
first 1, it becomes {1, 1}. After the
second 1 it becomes {2, 2}. After the
third 1, it becomes {3, 3}.

Your Task:
You don't need to read input or print anything. Your task is to complete the function update() which takes the array A[] and its size N as inputs and make the updates and fill the array A[].

Expected Time Complexity: O(N)
Expected Auxiliary Space: O(1)

Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/adding-ones3628/1

Powered by hirist.com
πŸ‘5😁1
Must Learn!πŸ’‘
Whether playing intensely competitive shooters, fighting, or racing games, a controller can be used in a variety of ways to help the player optimize their abilities.

While some Xbox or PS5 controllers have responsive buttons required for quick-fire action, others have additional programmable paddles on the device’s back.

Learn about the top 10 gaming controllers via this article- https://www.geeksforgeeks.org/10-top-gaming-controllers/?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=top10gamingcontrollers
πŸ‘3
🚨Job Alert🚨
athenahealth is hiring for Java Developer.

Location - Chennai
Experience - 2 - 7 Years
Apply by - Jun 18, 2023

Apply via the following link and share the opportunity with your friends- https://www.geeksforgeeks.org/jobs/athenahealth-javadeveloper-3204?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=javadeveloper
Problem Of The Day
"Rod Cutting"

Solve the problem to win points

Today's Problem! Apply For Mega Job-A-Thon

Given a rod of length N inches and an array of prices, price[]. price[i] denotes the value of a piece of length i. Determine the maximum value obtainable by cutting up the rod and selling the pieces.

Note: Consider 1-based indexing.

Example 1:
Input:
N = 8
Price[] = {1, 5, 8, 9, 10, 17, 17, 20}
Output:
22
Explanation:
The maximum obtainable value is 22 by
cutting in two pieces of lengths 2 and
6, i.e., 5+17=22.

Example 2:
Input:
N=8
Price[] = {3, 5, 8, 9, 10, 17, 17, 20}
Output:
24
Explanation:
The maximum obtainable value is
24 by cutting the rod into 8 pieces
of length 1, i.e, 8*3=24.

Your Task:
You don't need to read input or print anything. Your task is to complete the function cutRod() which takes the array A[] and its size N as inputs and returns the maximum price obtainable.

Expected Time Complexity: O(N2)
Expected Auxiliary Space: O(N)

Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/rod-cutting0840/1

Powered by hirist.com
πŸ‘2
Must Learn!πŸ’‘
Python decorators are valuable tools for writing clean, versatile, reusable, and maintainable code, and as a result, are used extensively by software developers.

Decorators allow you to extend the behavior of a function or class without changing its source code. They are also widely used in many Python frameworks and libraries, such as Flask, Django, and SQLAlchemy.

Learn about top 10 Python built-in decorators that optimize PythonCode significally.

Link- https://www.geeksforgeeks.org/top-python-built-in-decorators-that-optimize-python-code-significantly/?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=pythoncode
Problem Of The Day
"k largest elements"

Solve the problem to win points

Given an array Arr of N positive integers and an integer K, find K largest elements from the array. The output elements should be printed in decreasing order.

Example 1:
Input:
N = 5, K = 2
Arr[] = {12, 5, 787, 1, 23}
Output: 787 23
Explanation: 1st largest element in the
array is 787 and second largest is 23.

Example 2:
Input:
N = 7, K = 3
Arr[] = {1, 23, 12, 9, 30, 2, 50}
Output: 50 30 23
Explanation: 3 Largest element in the
array are 50, 30 and 23.

Your Task:
You don't need to read input or print anything. Your task is to complete the function kLargest() which takes the array of integers arr, n and k as parameters and returns an array of integers denoting the answer. The array should be in decreasing order.

Expected Time Complexity: O(N + KlogK)
Expected Auxiliary Space: O(K+(N-K)*logK)

Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/k-largest-elements4206/1

Powered by hirist.com
πŸ‘2