Giter Club home page Giter Club logo

artofcoding's People

Contributors

2brownc avatar deepsourcebot avatar harshil-jani avatar isamad0201 avatar nandan-shah avatar rameshchandrapola avatar restyled-commits avatar sahilsingh7735 avatar santhoshs20 avatar seraph776 avatar soumikbaithalu avatar swastikbaithalu avatar

Stargazers

 avatar

Watchers

 avatar  avatar

artofcoding's Issues

Single Number

Given a non-empty array of integers nums, every element appears twice except for one. Find that single one.

You must implement a solution with a linear runtime complexity and use only constant extra space.

Example 1:

Input: nums = [2,2,1]
Output: 1
Example 2:

Input: nums = [4,1,2,1,2]
Output: 4
Example 3:

Input: nums = [1]
Output: 1

Constraints:

1 <= nums.length <= 3 * 104
-3 * 104 <= nums[i] <= 3 * 104
Each element in the array appears twice except for one element which appears only once.

4Sum

Problem Statement

Given an array nums of n integers, return an array of all the unique quadruplets [nums[a], nums[b], nums[c], nums[d]] such that:

0 <= a, b, c, d < n
a, b, c, and d are distinct.
nums[a] + nums[b] + nums[c] + nums[d] == target
You may return the answer in any order.

Example 1:

Input: nums = [1,0,-1,0,-2,2], target = 0
Output: [[-2,-1,1,2],[-2,0,0,2],[-1,0,0,1]]
Example 2:

Input: nums = [2,2,2,2,2], target = 8
Output: [[2,2,2,2]]

Constraints:

1 <= nums.length <= 200
-109 <= nums[i] <= 109
-109 <= target <= 109

NextGenTower Problem

Problem Statement 🗼

Human civilization now has its base on another planet called Geekland, all credit goes to Geeklog Gusk. There are N communication towers numbered from 0 to N-1 on the whole planet which are connected by M wires, each wire connects two different towers, more formally ith wire connects connections[i][0] and connections[i] [1] tower. All towers run on 9G technology.

Geeklog Gusk has decided to upgrade the technology of some towers to 10G, the newest and fastest technology ever made. If tower a is upgraded to 10G, then all towers which are connected to tower a should also be upgraded. More formally two towers should have the same technology if they are connected. Geeklog only has enough budget to upgrade atmost X towers. Find a maximum number of towers which can be upgraded.

Example 1:

Input:

N = 4, M = 2, X = 3
connections[ ][ ] = {{1, 2},
{0, 3}}

Output:

2

Explanation:

Either tower 1 and 2 or tower 3 and 4
can be upgraded.

Example

Input:

N = 4, M = 3, X = 3
connections[ ][ ] = {{0, 1},
{1, 2},
{2, 3}}

Output:

0

Explanation:

No tower can be upgraded.

C language Problem

Add the Folder of C language and then add other which problem is related like it's an if the problem is related to backtracking and add a folder of backtracking if the problem is related to Dynamic Programming the add the folder of Dynamic programming, etc.

Longest Happy Prefix

A string is called a happy prefix if is a non-empty prefix which is also a suffix (excluding itself).

Given a string s, return the longest happy prefix of s. Return an empty string "" if no such prefix exists.

1 <= s.length <= 105
s contains only lowercase English letters.

Broken Link

🐛 Bug Report

(A clear and concise description of what the bug is.)

The link to the issues template: /ISSUE_TEMPLATE/algorithm-ds-proposal.md on the README.md file under Contributing Guidelines is broken [404 Error] .

Have you read the Contributing Guidelines on Pull Requests?

  • Yes 👍🏽

Valid Palindrome

🚀 Feature

Given a string s, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases

Have you read the Contributing Guidelines on Pull Requests?

yes

Pitch

Example 1:

Input: s = "A man, a plan, a canal: Panama"
Output: true
Explanation: "amanaplanacanalpanama" is a palindrome.

Candy

There are n children standing in a line. Each child is assigned a rating value given in the integer array ratings.

You are giving candies to these children subjected to the following requirements:

Each child must have at least one candy.
Children with a higher rating get more candies than their neighbors.
Return the minimum number of candies you need to have to distribute the candies to the children.

Example 1:

Input: ratings = [1,0,2]
Output: 5
Explanation: You can allocate to the first, second and third child with 2, 1, 2 candies respectively.
Example 2:

Input: ratings = [1,2,2]
Output: 4
Explanation: You can allocate to the first, second and third child with 1, 2, 1 candies respectively.
The third child gets 1 candy because it satisfies the above two conditions.

Constraints:

n == ratings.length
1 <= n <= 2 * 104
0 <= ratings[i] <= 2 * 104

C++ Problem

Add the Folder of C++ and then add other which problem is related like it's an if the problem is related to backtracking and add a folder of backtracking if the problem is related to Dynamic Programming the add the folder of Dynamic programming, etc.

Restyled.io Removal Request!

🐛 Bug Report

I want to ask can we remove Restyle.io ? Because It is just creating some extra spaces which in general are not in practice even in real world software companies. Developers prefer less spaces in code. It tries making code neat but, always creates PR issues. If possible can we remove it?

Have you read the Contributing Guidelines on Pull Requests?

Yes.

JavaScript Problem

Add the Folder of JavaScript and then add other which problem is related like it's an if the problem is related to backtracking and add a folder of backtracking if the problem is related to Dynamic Programming the add the folder of Dynamic programming, etc.

Rat Count House 🐀 Problem

Problem Statement 🐀

The function accepts two positive integers ‘r’ and ‘unit’ and a positive integer array ‘arr’ of size ‘n’ as its argument ‘r’ represents the number of rats present in an area, ‘unit’ is the amount of food each rat consumes and each ith element of array ‘arr’ represents the amount of food present in ‘i+1’ house number, where 0 <= i

Note :

  • Return -1 if the array is null
  • Return 0 if the total amount of food from all houses is not sufficient for all the rats.
  • Computed values lie within the integer range.

Example:

Input:

r: 7
unit: 2
n: 8
arr: 2 8 3 5 7 4 1 2
Output:

4

Explanation:

Total amount of food required for all rats = r * unit

= 7 * 2 = 14.

The amount of food in 1st houses = 2+8+3+5 = 18. Since, amount of food in 1st 4 houses is sufficient for all the rats. Thus, output is 4.

3Sum

Problem Statement

Given an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] == 0.

Notice that the solution set must not contain duplicate triplets.

Example 1:

Input: nums = [-1,0,1,2,-1,-4]
Output: [[-1,-1,2],[-1,0,1]]
Example 2:

Input: nums = []
Output: []
Example 3:

Input: nums = [0]
Output: []

Constraints:

0 <= nums.length <= 3000
-105 <= nums[i] <= 105

Hacktoberfest2021 🎆 🎆

Hacktoberfest2021 🎆 🎆

Hacktoberfest is a month-long event where people are awarded for contributing to open source projects 🙌, and we're joining the party . Hosted by DigitalOcean for the 8th year in a row, Hacktoberfest encourages participation in giving back to the open-source community by completing pull requests, participating in events, and donating to open source projects.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.