Commit Graph

141 Commits

Author SHA1 Message Date
hemanth8819 db69d0a539
feat: add LeetCode problem 69 (#1259)
* feat: add LeetCode problem 69

Here is the code for the problem 69 of leetcode as there are many ways to do it we programmers need to find the most optimal way to solve a problem statement so i used binary-search approach inorder to solve it.
All  suggestions are accepted!!!

* Update 69.c

I have updated the solution according to the suggestions.

* Update 69.c

* Update 69.c
2023-06-27 13:49:43 -06:00
Aditya Pal 2b885108b8
feat: add LeetCode problem 434 (#1252)
* feat: add LeetCode problem 434

Adds solution of problem 434 for leetcode. Beats 100% Time, 97.18% space

* docs: updating `leetcode/DIRECTORY.md`

* Update 434.c

---------

Co-authored-by: PalAditya <PalAditya@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Alexander Pantyukhin <apantykhin@gmail.com>
2023-04-27 13:37:59 -06:00
Rishav Kumar 9997c8bdf0
fix: memory allocation method (#1220)
* Fix : memory allocation method

"new" is not used in C , because of that the compiler was giving compilation error.
Instead malloc was used for memory allocation.

* updating DIRECTORY.md

* Update data_structures/graphs/kruskal.c

Co-authored-by: Stepfen Shawn <m18824909883@163.com>

* updating DIRECTORY.md

---------

Co-authored-by: github-actions[bot] <github-actions@users.noreply.github.com>
Co-authored-by: Stepfen Shawn <m18824909883@163.com>
2023-03-17 12:01:44 -06:00
Mindaugas f0b38a3201
feat: remove nth node from end of list LeetCode (#1222)
* feat: remove nth node from end of list (leetcode #19)

* fix: update the leetcode #19 solution to introduce node pointing to head

---------

Co-authored-by: David Leal <halfpacho@gmail.com>
2023-03-03 09:12:04 -06:00
Alexander Pantyukhin 1cfb88c5eb
docs: update the LeetCode contributing guide (#1225)
* Update README.md

Remove not actual information regrading the solutions list. Now it's updated automaticaly.

* updating DIRECTORY.md

* Update README.md

add note about automatically updating the `DIRECTORY.md` file

* Update leetcode/README.md

Co-authored-by: David Leal <halfpacho@gmail.com>

* updating DIRECTORY.md

---------

Co-authored-by: github-actions[bot] <github-actions@users.noreply.github.com>
Co-authored-by: David Leal <halfpacho@gmail.com>
2023-02-28 20:28:06 -06:00
Mindaugas 3c8f86e740
feat: add Letter combinations of phone book problem (#1221)
* feat: add Letter combinations of phone book problem (#17)

* fix: add newline at the end of the file

* fix: add brief description of the algorithm

---------

Co-authored-by: David Leal <halfpacho@gmail.com>
2023-02-28 01:17:31 -06:00
Alexander Pantyukhin 0bc8f7a576
feat: add LeetCode jump game II (#1213)
* add leetcode Jump Game II

* updating DIRECTORY.md

* Update 45.c

free correct resources

* Update leetcode/src/45.c

Co-authored-by: David Leal <halfpacho@gmail.com>

* Update leetcode/src/45.c

Co-authored-by: David Leal <halfpacho@gmail.com>

* Update leetcode/src/45.c

Co-authored-by: David Leal <halfpacho@gmail.com>

* Update leetcode/src/45.c

Co-authored-by: David Leal <halfpacho@gmail.com>

* Update leetcode/src/45.c

Co-authored-by: David Leal <halfpacho@gmail.com>

* updating DIRECTORY.md

---------

Co-authored-by: github-actions[bot] <github-actions@users.noreply.github.com>
Co-authored-by: David Leal <halfpacho@gmail.com>
2023-02-28 00:55:09 -06:00
Mindaugas 6e94adf066
feat: add Longest Palindrome Substring solution (#1210)
* feat: add Longest Palindrome Substring solution

* fix: update formatting and allocate new results string

* fix: update formatting, fix bug related to the string copy

* fix: add parantheses for one line if statement

* fix: add comments for library inclusions
2023-02-25 20:35:50 +00:00
Heber Alturria f6a326b268
feat: add LeetCode problem 540 (#1217)
* feat: add LeetCode problem 540

* feat: Added a description to the LeetCode problem 540

* feat: Added details in the description of the LeetCode problem 540

* feat: Changed a word in @details of the LeetCode problem 540
2023-02-23 11:32:04 -06:00
Mindaugas 5d3a841aa6
feat: add solution for the 3Sum Closest problem (#16) (#1216)
* feat: add solution for the 3Sum Closest problem (#16)

* fix: Update formatting

* fix: update compare function to avoid overflow in generic case

* chore: apply suggestions from code review

---------

Co-authored-by: David Leal <halfpacho@gmail.com>
2023-02-21 18:55:09 +08:00
Alexander Pantyukhin 2d505ccf13
add leetcode Permutation in String (#1207)
* add leetcode Permutation in String

* updating DIRECTORY.md

* Update leetcode/src/567.c

Co-authored-by: Stepfen Shawn <m18824909883@163.com>

* Update leetcode/src/567.c

Co-authored-by: Stepfen Shawn <m18824909883@163.com>

* Update leetcode/src/567.c

Co-authored-by: Stepfen Shawn <m18824909883@163.com>

* Update leetcode/src/567.c

Co-authored-by: Stepfen Shawn <m18824909883@163.com>

* Update leetcode/src/567.c

Co-authored-by: Stepfen Shawn <m18824909883@163.com>

* Update leetcode/src/567.c

Co-authored-by: Stepfen Shawn <m18824909883@163.com>

* Update leetcode/src/567.c

Co-authored-by: Stepfen Shawn <m18824909883@163.com>

* Update leetcode/src/567.c

Co-authored-by: Stepfen Shawn <m18824909883@163.com>

* Update leetcode/src/567.c

Co-authored-by: Stepfen Shawn <m18824909883@163.com>

* Update leetcode/src/567.c

Co-authored-by: Stepfen Shawn <m18824909883@163.com>

* Update leetcode/src/567.c

Co-authored-by: Stepfen Shawn <m18824909883@163.com>

* Update leetcode/src/567.c

Co-authored-by: Stepfen Shawn <m18824909883@163.com>

* Update 567.c

fix review notes

* Update 567.c

remove redundant line

---------

Co-authored-by: github-actions[bot] <github-actions@users.noreply.github.com>
Co-authored-by: Stepfen Shawn <m18824909883@163.com>
2023-02-06 04:52:24 -06:00
Alexander Pantyukhin 4830210f69
add leetcode Verifying an Alien Dictionary (#1205)
* add leetcode Verifying an Alien Dictionary

* updating DIRECTORY.md

* Update 953.c

add blank line at the end

---------

Co-authored-by: github-actions[bot] <github-actions@users.noreply.github.com>
Co-authored-by: David Leal <halfpacho@gmail.com>
2023-02-04 12:51:01 +00:00
Alexander Pantyukhin 55f73501ea
feat: add Distribute Coins in Binary Tree LeetCode (#1206)
* add leetcode Distribute Coins in Binary Tree

* updating DIRECTORY.md

* Update 979.c

fix review notes

* Update leetcode/src/979.c

Co-authored-by: David Leal <halfpacho@gmail.com>

* Update leetcode/src/979.c

Co-authored-by: David Leal <halfpacho@gmail.com>

* Update leetcode/src/979.c

Co-authored-by: David Leal <halfpacho@gmail.com>

* Update leetcode/src/979.c

Co-authored-by: David Leal <halfpacho@gmail.com>

---------

Co-authored-by: github-actions[bot] <github-actions@users.noreply.github.com>
Co-authored-by: David Leal <halfpacho@gmail.com>
2023-02-03 18:11:43 -06:00
Alexander Pantyukhin 9fa578d4b5
feat: add N-th Tribonacci number (#1202)
* add leetcode n-th Tribonacci number

* updating DIRECTORY.md

* updating DIRECTORY.md

---------

Co-authored-by: github-actions[bot] <github-actions@users.noreply.github.com>
2023-02-02 19:58:32 -06:00
Alexander Pantyukhin e2b8a617d6
feat: add Find the Town Judge LeetCode problem (#1199)
* add leetcode Find the Town Judge

* updating DIRECTORY.md

* Update leetcode/src/997.c

Co-authored-by: David Leal <halfpacho@gmail.com>

* updating DIRECTORY.md

---------

Co-authored-by: David Leal <halfpacho@gmail.com>
Co-authored-by: github-actions[bot] <github-actions@users.noreply.github.com>
2023-01-31 13:26:17 -06:00
Alexander Pantyukhin 88d29872f9
feat: add LeetCode Pow(x, n) (#1194)
* add leetcode Pow(x, n)

* Update 50.c

fix comment

* Update 50.c

simplification

* add lower_bound const.

* updating DIRECTORY.md

Co-authored-by: David Leal <halfpacho@gmail.com>
Co-authored-by: github-actions[bot] <github-actions@users.noreply.github.com>
2023-01-23 23:06:49 -06:00
Alexander Pantyukhin 90d7d81807
feat: Add LeetCode directory writer (#1187)
* add leetcode_directory_writer

* updating DIRECTORY.md

* Update leetcode_directory_md.py

add script header

* updating DIRECTORY.md

* updating DIRECTORY.md

* Update .github/workflows/leetcode_directory_writer.yml

Co-authored-by: David Leal <halfpacho@gmail.com>

* Update .github/workflows/leetcode_directory_writer.yml

Co-authored-by: David Leal <halfpacho@gmail.com>

* Update .github/workflows/leetcode_directory_writer.yml

Co-authored-by: David Leal <halfpacho@gmail.com>

* Update .github/workflows/leetcode_directory_writer.yml

Co-authored-by: David Leal <halfpacho@gmail.com>

* Update .github/workflows/leetcode_directory_writer.yml

Co-authored-by: David Leal <halfpacho@gmail.com>

* updating DIRECTORY.md

* Update .github/workflows/leetcode_directory_writer.yml

Co-authored-by: David Leal <halfpacho@gmail.com>

* updating DIRECTORY.md

* Update .github/workflows/leetcode_directory_writer.yml

Co-authored-by: David Leal <halfpacho@gmail.com>

* updating DIRECTORY.md

* updating DIRECTORY.md

* Update .github/workflows/leetcode_directory_writer.yml

Co-authored-by: Taj <tjgurwara99@users.noreply.github.com>

* Update scripts/leetcode_directory_md.py

Co-authored-by: Taj <tjgurwara99@users.noreply.github.com>

* Update scripts/leetcode_directory_md.py

Co-authored-by: Taj <tjgurwara99@users.noreply.github.com>

* Update scripts/leetcode_directory_md.py

Co-authored-by: Taj <tjgurwara99@users.noreply.github.com>

* fix formating

* updating DIRECTORY.md

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: David Leal <halfpacho@gmail.com>
Co-authored-by: github-actions[bot] <github-actions@users.noreply.github.com>
Co-authored-by: Taj <tjgurwara99@users.noreply.github.com>
2023-01-23 11:24:50 -06:00
Alexander Pantyukhin 74ef8f5806
feat: add Binary Tree Maximum Path Sum (#1179)
* add leetcode Binary Tree Maximum Path Sum

* Update leetcode/src/124.c

Co-authored-by: Taj <tjgurwara99@users.noreply.github.com>

Co-authored-by: David Leal <halfpacho@gmail.com>
Co-authored-by: Taj <tjgurwara99@users.noreply.github.com>
2023-01-21 18:42:07 -06:00
Satvik 5ac30afa86
feat: add LeetCode problem 75 (#1113)
* added leetcode problem 75

* Update 75.c

resolved issues

* Update 75.c

* updating DIRECTORY.md

* Update 75.c

Removed the header file

* chore: apply suggestions from code review

Co-authored-by: Taj <tjgurwara99@users.noreply.github.com>

* updating DIRECTORY.md

Co-authored-by: David Leal <halfpacho@gmail.com>
Co-authored-by: Taj <tjgurwara99@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions@users.noreply.github.com>
2023-01-20 17:50:49 -06:00
Alexander Pantyukhin a680c83b83
feat: add Maximum Ice Cream Bars (#1197)
Co-authored-by: David Leal <halfpacho@gmail.com>
2023-01-20 17:49:15 -06:00
Alexander Pantyukhin 17b7131873
add leetcode Maximum Bags With Full Capacity of Rocks (#1196)
* add leetcode Maximum Bags With Full Capacity of Rocks

* Update leetcode/src/2279.c

Co-authored-by: David Leal <halfpacho@gmail.com>

* Update leetcode/src/2279.c

Co-authored-by: David Leal <halfpacho@gmail.com>

* Update leetcode/src/2279.c

Co-authored-by: David Leal <halfpacho@gmail.com>
2023-01-20 17:48:26 -06:00
Alexander Pantyukhin b98296e02f
feat: add Determine if Two Strings Are Close (#1192)
* add leetcode Determine if Two Strings Are Close

* Update 1657.c

add comments

* Update leetcode/src/1657.c

Co-authored-by: David Leal <halfpacho@gmail.com>
2023-01-20 17:46:02 -06:00
Alexander Pantyukhin 73913ac4a8
feat: add Find the Smallest Divisor Given a Threshold (#1175)
* add leetcode Find the Smallest Divisor Given a Threshold

* Update leetcode/DIRECTORY.md

Co-authored-by: David Leal <halfpacho@gmail.com>
2023-01-20 17:39:35 -06:00
Alexander Pantyukhin b819ddf3e6
feat: add Frequency of the Most Frequent Element (#1195)
* add leetcode Frequency of the Most Frequent Element

* Update 1838.c

small fix

* Update leetcode/src/1838.c

Co-authored-by: David Leal <halfpacho@gmail.com>
2023-01-20 15:42:23 -06:00
Alexander Pantyukhin 60a0c5947d
feat: add Difference Between Ones and Zeros in Row and Column (#1183)
* add leetcode Difference Between Ones and Zeros in Row and Column

* Update leetcode/DIRECTORY.md

Co-authored-by: David Leal <halfpacho@gmail.com>
2023-01-19 22:43:10 -06:00
Sindhu Inti e68296c07c
feat: add delete the Middle Node of a Linked List solution (#1023)
* feat:leetcode Delete the Middle Node of a Linked List solution (2095)

* Update README.md

* Update README.md

* Update DIRECTORY.md

Co-authored-by: David Leal <halfpacho@gmail.com>
2023-01-19 22:29:34 -06:00
Alexander Pantyukhin 103361de54
feat: add Keys and Rooms LeetCode problem (#1189)
Co-authored-by: David Leal <halfpacho@gmail.com>
2023-01-19 22:09:32 -06:00
Alexander Pantyukhin 02c01047a7
feat: add Longest Chunked Palindrome Decomposition (#1184)
* add leetcode Longest Chunked Palindrome Decomposition

* Update leetcode/src/1147.c

Co-authored-by: David Leal <halfpacho@gmail.com>

* Update 1147.c

fix review

Co-authored-by: David Leal <halfpacho@gmail.com>
2023-01-18 14:34:19 -06:00
Alexander Pantyukhin 108fbede16
feat: add Longest Square Streak in an Array (#1185)
Co-authored-by: David Leal <halfpacho@gmail.com>
2023-01-18 14:06:45 -06:00
Alexander Pantyukhin 1b6fe6ea17
feat: add Minimum Falling Path Sum (#1182)
Co-authored-by: David Leal <halfpacho@gmail.com>
2023-01-18 13:54:30 -06:00
Alexander Pantyukhin 36d1b265a7
feat: add Redundant Connection (#1181)
Co-authored-by: David Leal <halfpacho@gmail.com>
2023-01-18 13:15:47 -06:00
Alexander Pantyukhin 78d083fd84
feat: add Maximum Difference Between Node and Ancestor (#1180)
* add leetcode Maximum Difference Between Node and Ancestor

* chore: fix Markdown ordering

Co-authored-by: David Leal <halfpacho@gmail.com>
2023-01-18 13:15:20 -06:00
Alexander Pantyukhin 8cbb76a02b
feat: add Number of Laser Beams in a Bank (#1174)
Co-authored-by: David Leal <halfpacho@gmail.com>
2023-01-18 13:13:06 -06:00
Alexander Pantyukhin b8a8807585
feat: add Minimum Average Difference (#1171)
* add leetcode Minimum Average Difference

* updating DIRECTORY.md

Co-authored-by: David Leal <halfpacho@gmail.com>
Co-authored-by: github-actions[bot] <github-actions@users.noreply.github.com>
2022-12-27 11:45:39 -06:00
Alexander Pantyukhin bed955ed40
feat: add Max Increase to Keep City Skyline (#1173)
Co-authored-by: David Leal <halfpacho@gmail.com>
2022-12-27 01:21:10 -06:00
Alexander Pantyukhin 0618d4d007
feat: add H-Index LeetCode problem (#1188)
* add leetcode H-Index

* Update leetcode/src/274.c

Co-authored-by: Taj <tjgurwara99@users.noreply.github.com>

* Update 274.c

fix review notes.

Co-authored-by: David Leal <halfpacho@gmail.com>
Co-authored-by: Taj <tjgurwara99@users.noreply.github.com>
2022-12-21 22:42:07 -06:00
Alexander Pantyukhin 7aae73495f
feat: add Lowest Common Ancestor of a Binary Tree (#1155)
* add leetcode Lowest Common Ancestor of a Binary Tree

* Update leetcode/src/236.c

Co-authored-by: Taj <tjgurwara99@users.noreply.github.com>

* fix function nam

* update struct name.

* add comments

* Update leetcode/src/236.c

Co-authored-by: Taj <tjgurwara99@users.noreply.github.com>

Co-authored-by: Taj <tjgurwara99@users.noreply.github.com>
Co-authored-by: David Leal <halfpacho@gmail.com>
2022-12-21 08:46:34 -06:00
Alexander Pantyukhin 9f1591fbd2
feat: add Sudoku Solver LeetCode (#1162)
Co-authored-by: David Leal <halfpacho@gmail.com>
2022-12-21 08:44:43 -06:00
Alexander Pantyukhin 0169283f55
feat: add Number of Ways to Select Buildings (#1140)
* add Number of Ways to Select Buildings

* Update 2222.c

add new line at the end

* Rename README.md to DIRECTORY.md

* Update leetcode/src/2222.c

Co-authored-by: Taj <tjgurwara99@users.noreply.github.com>

* fix review notes

Co-authored-by: David Leal <halfpacho@gmail.com>
Co-authored-by: Taj <tjgurwara99@users.noreply.github.com>
2022-12-18 21:34:24 -06:00
Alexander Pantyukhin 50349e065e
feat: add Word Search LeetCode problem (#1160)
Co-authored-by: David Leal <halfpacho@gmail.com>
2022-12-16 20:28:51 -06:00
Alexander Pantyukhin 496e012c70
feat: add Kth Smallest Element in a BST (#1157)
Co-authored-by: David Leal <halfpacho@gmail.com>
2022-12-16 20:24:33 -06:00
Alexander Pantyukhin bf94aff668
feat: add Determine if String Halves Are Alike LeetCode (#1168)
* add leetcode Determine if String Halves Are Alike

* fix variable  name

Co-authored-by: David Leal <halfpacho@gmail.com>
2022-12-16 15:43:25 -06:00
Alexander Pantyukhin 1d07d142d0
feat: add Number of Ways to Split Array LeetCode (#1165)
Co-authored-by: David Leal <halfpacho@gmail.com>
2022-12-16 15:42:57 -06:00
Alexander Pantyukhin 8992d267ac
feat: add Longest Valid Parentheses LeetCode problem (#1166)
Co-authored-by: David Leal <halfpacho@gmail.com>
2022-12-16 15:37:54 -06:00
Alexander Pantyukhin 2ee92040f3
feat: add Maximum Erasure Value LeetCode problem (#1137)
* add leetcode Maximum Erasure Value

* Update 1695.c

add new line at the end

* Rename README.md to DIRECTORY.md

* chore: apply suggestions from code review

* Update DIRECTORY.md

* Update leetcode/DIRECTORY.md

Co-authored-by: Taj <tjgurwara99@users.noreply.github.com>

Co-authored-by: David Leal <halfpacho@gmail.com>
Co-authored-by: Taj <tjgurwara99@users.noreply.github.com>
2022-12-01 23:18:59 -06:00
Alexander Pantyukhin b37bf7f6b9
feat: add Trim a Binary Search Tree LeetCode problem (#1156) 2022-12-01 23:11:58 -06:00
Alexander Pantyukhin 794ec129ae
feat: add Minimum Number of Operations to... (#1146)
...Move All Balls to Each Box LeetCode problem.

* add Minimum Number of Operations to Move All Balls to Each Box leetcode

* chore: apply suggestions from code review

* Update leetcode/src/1769.c

Co-authored-by: Taj <tjgurwara99@users.noreply.github.com>

Co-authored-by: David Leal <halfpacho@gmail.com>
Co-authored-by: Taj <tjgurwara99@users.noreply.github.com>
2022-12-01 23:03:24 -06:00
Alexander Pantyukhin bb11a35227
feat: add Maximize the Confusion LeetCode problem (#1150)
* add Maximize the Confusion of an Exam leetcode

* Update leetcode/src/2024.c

Co-authored-by: Taj <tjgurwara99@users.noreply.github.com>

* Update 2024.c

fix build

Co-authored-by: Taj <tjgurwara99@users.noreply.github.com>
2022-12-01 22:55:36 -06:00
Alexander Pantyukhin 435b4994ce
feat: add Validate Binary Search Tree (#1153)
* add Validate Binary Search Tree

* improve condition
2022-11-25 18:54:41 -06:00
Alexander Pantyukhin defd82dda1
feat: add Minimum Deletions LeetCode problem (#1138)
* add Minimum Deletions to Make String Balanced

* Update 1653.c

add new line at the end

* Rename README.md to DIRECTORY.md

* chore: apply suggestions from code review

* Update leetcode/src/1653.c

Co-authored-by: Taj <tjgurwara99@users.noreply.github.com>

* Update leetcode/src/1653.c

Co-authored-by: Taj <tjgurwara99@users.noreply.github.com>

* Update leetcode/src/1653.c

Co-authored-by: Taj <tjgurwara99@users.noreply.github.com>

* Update 1653.c

remove redundant define

* Update leetcode/src/1653.c

Co-authored-by: John Law <johnlaw.po@gmail.com>

Co-authored-by: David Leal <halfpacho@gmail.com>
Co-authored-by: Taj <tjgurwara99@users.noreply.github.com>
Co-authored-by: John Law <johnlaw.po@gmail.com>
2022-11-25 17:38:33 -06:00