Skip to content

PhuvatatDev/dart_algos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

33 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ‘€ Dart Algorithms by PVTDev

A personal collection of algorithm exercises written in Dart to practice logic, problem-solving, and clean code.

This repository is part of my journey to become a proficient Flutter & full-stack mobile developer. Each exercise is saved in a separate file with clean code, comments, and tested outputs.


πŸ“š Exercises List

πŸ”Ή 01 - Find the most frequent element

Description: Finds the element that appears the most in a list of integers.
πŸ“„ File: exos_01_most_frequent_element.dart


πŸ”Ή 02 - Find the two largest numbers

Description: Returns the 2 highest values in a list without using sort().
πŸ“„ File: exos_02_two_largest_numbers.dart


πŸ”Ή 03 - Find the missing number in a list

Description: Detects the only missing number in a list of integers from 1 to N.
πŸ“„ File: exos_03_missing_number_in_consecutive_list.dart


πŸ”Ή 04 - Find all prime numbers up to N

Description: Returns a list of all prime numbers between 2 and N.
πŸ“„ File: exos_04_find_all_prime_numbers_up_to_n.dart


πŸ”Ή 05 - Filter integers with even digit sums

Description: Filters a list of integers and returns only those whose digits add up to an even number.
πŸ“„ File: exos_05_filter_even_digit_sums.dart


πŸ”Ή 06 - Is Pangram

Description: Checks if a given string is a pangram, meaning it contains every letter of the alphabet at least once.
πŸ“„ File: exos_06_is_pangram.dart


πŸ”Ή 07 - Keys by Value in a Map

Description: Returns all the keys in a Map that are associated with a given value.
πŸ“„ File: exos_07_keys_by_value.dart


πŸ”Ή 08 - Anagram Checker

Description: Determines whether two strings are anagrams (same letters, different order, ignoring spaces and case).
πŸ“„ File: exos_08_anagram_checker.dart


πŸ”Ή 09 - Group Words by Length

Description: Groups a list of strings by word length into a Map<int, List<String>>.
πŸ“„ File: exos_09_group_by_length.dart


πŸ”Ή 10 - Most common first letter

Description: Finds the most common first letter in a list of words. In case of a tie, returns the one that comes first alphabetically.
πŸ“„ File: exos_10_most_common_first_letter.dart


πŸ”Ή 11 - Most frequent letter

Description: Finds the most frequent character (letter) in a string. Ignores case and non-letter characters.
πŸ“„ File: exos_11_most_frequent_letter.dart


πŸ”Ή 12 - Group words by length

Description: Groups a list of words into a Map<int, List<String>> based on word length.
πŸ“„ File: exos_12_group_words_by_length.dart


πŸ”Ή 13 - Count words starting with a letter

Description: Counts how many words in a list start with a specific letter (case-insensitive).
πŸ“„ File: exos_13_count_words_starting_with.dart


πŸ”Ή 14 - Common letters between two strings

Description: Returns the list of distinct letters that appear in both input strings (case-insensitive).
πŸ“„ File: exos_14_common_letters.dart


πŸ”Ή 15 - Sum of unique values

Description: Returns the sum of all integers in a list that appear only once.
πŸ“„ File: exos_15_sum_of_unique_values.dart


πŸ”Ή 16 - Group words by first letter

Description: Groups a list of words into a Map<String, List<String>> based on their first letter (lowercase).
πŸ“„ File: exos_16_group_words_by_first_letter.dart


πŸ”Ή 17 - Most frequent word length

Description: Determines the most common word length in a list of words. In case of a tie, returns the smallest length.
πŸ“„ File: exos_17_most_frequent_word_length.dart


πŸ”Ή 18 - Remove duplicates (keep order)

Description: Removes duplicate values from a list while keeping the original order of elements.
πŸ“„ File: exos_18_remove_duplicates_keep_order.dart


πŸ”Ή 19 - Longest consecutive sequence

Description: Returns the length of the longest consecutive sequence of integers in an unsorted list.
πŸ“„ File: exos_19_longest_consecutive_sequence.dart


πŸ”Ή 20 - Group words by last letter

Description: Groups a list of words into a Map<String, List<String>> based on their last letter (lowercase).
πŸ“„ File: exos_20_group_by_last_letter.dart


πŸ”Ή 21 - Find the mode from a list

Description: Returns the most frequent number in a list. In case of a tie, returns the smallest one.
πŸ“„ File: exos_21_mode_from_list.dart


πŸ”Ή 22 - Insertion sort extension

Description: Implements the insertion sort algorithm as an extension method on List<int>.
πŸ“„ File: exos_22_insertion_sort_extension.dart


πŸ”Ή 23 - Reverse words in a string

Description: Reverses the order of words in a given string while preserving word content.
πŸ“„ File: exos_23_reverse_words.dart


βœ… Goals

  • Practice clean and readable Dart code.
  • Build confidence in solving logic-based challenges.
  • Prepare for technical interviews and app feature logic.

▢️ How to run the algorithms

To run any exercise, make sure you have the Dart SDK installed.
Then open your terminal at the root of this project and run:

dart exos/exos_01_most_frequent_element.dart



| #  | Exercise Title                              | Description |
|----|---------------------------------------------|-------------|
| 01 | Find the most frequent element              | Finds the element that appears the most in a list of integers. |
| 02 | Find the two largest numbers                | Returns the 2 highest values in a list without using `sort()`. |
| 03 | Find the missing number in a list           | Detects the only missing number in a list of integers from 1 to N. |
| 04 | Find all prime numbers up to N              | Returns a list of all prime numbers between 2 and N. |
| 05 | Filter integers with even digit sums        | Filters integers whose digits add up to an even number. |
| 06 | Is Pangram                                  | Checks if a string contains every letter of the alphabet at least once. |
| 07 | Keys by Value in a Map                      | Returns all keys associated with a given value in a `Map`. |
| 08 | Anagram Checker                             | Checks if two strings are anagrams (same letters, different order). |
| 09 | Group Words by Length                       | Groups words by their length into a `Map<int, List<String>>`. |
| 10 | Most common first letter                    | Finds the most common first letter in a list of words. |
| 11 | Most frequent letter                        | Finds the most frequent letter in a string (ignores case and non-letters). |
| 12 | Group words by length                       | Groups words into a `Map<int, List<String>>` based on length. |
| 13 | Count words starting with a letter          | Counts how many words start with a specific letter. |
| 14 | Common letters between two strings          | Returns distinct letters appearing in both strings. |
| 15 | Sum of unique values                        | Sums all integers that appear only once in a list. |
| 16 | Group words by first letter                 | Groups words into a `Map<String, List<String>>` based on their first letter. |
| 17 | Most frequent word length                   | Finds the most common word length in a list. |
| 18 | Remove duplicates (keep order)              | Removes duplicates from a list while keeping order. |
| 19 | Longest consecutive sequence                | Finds the length of the longest consecutive sequence of integers. |
| 20 | Group words by last letter                  | Groups words into a `Map<String, List<String>>` based on their last letter. |
| 21 | Find the mode from a list                   | Finds the most frequent number in a list (smallest if tie). |
| 22 | Insertion sort extension                    | Implements insertion sort as an extension on `List<int>`. |
| 23 | Reverse words in a string                   | Reverses the order of words in a given string. |

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages