refactor(work): restructure solution directories with bucket level and add .gitkeep placeholders

This commit is contained in:
Prad Nukala
2026-08-31 10:41:40 -04:00
parent b21ab75e0e
commit 7e46fceb1c
41 changed files with 0 additions and 0 deletions
@@ -0,0 +1,49 @@
/*
* 1832. Check if the Sentence Is Pangram
* Difficulty: Easy
* https://leetcode.com/problems/check-if-the-sentence-is-pangram/
*
* ──────────────────────────────────────────────────
*
* A pangram is a sentence where every letter of the English alphabet
* appears at least once.
*
* Given a string sentence containing only lowercase English letters,
* return true if sentence is a pangram, or false otherwise.
*
*
*
* Example 1:
*
* Input: sentence = "thequickbrownfoxjumpsoverthelazydog"
* Output: true
* Explanation: sentence contains at least one of every letter of the
* English alphabet.
*
* Example 2:
*
* Input: sentence = "leetcode"
* Output: false
*
*
*
* Constraints:
*
* • 1 <= sentence.length <= 1000
*
* • sentence consists of lowercase English letters.
*/
/**
* @param {string} sentence
* @return {boolean}
*/
var checkIfPangram = function(sentence) {
const freq = {};
for (let c of sentence) freq[c] = (freq[c] || 0) + 1;
if (Object.keys(freq).length === 26){
return true;
}
return false;
};
@@ -0,0 +1,55 @@
/*
* 242. Valid Anagram
* Difficulty: Easy
* https://leetcode.com/problems/valid-anagram/
*
* ──────────────────────────────────────────────────
*
* Given two strings s and t, return true if t is an anagram of s, and
* false otherwise.
*
*
*
* Example 1:
*
* Input: s = "anagram", t = "nagaram"
*
* Output: true
*
* Example 2:
*
* Input: s = "rat", t = "car"
*
* Output: false
*
*
*
* Constraints:
*
* • 1 <= s.length, t.length <= 5 * 10^4
*
* • s and t consist of lowercase English letters.
*
*
*
* Follow up: What if the inputs contain Unicode characters? How would
* you adapt your solution to such a case?
*/
/**
* @param {string} s
* @param {string} t
* @return {boolean}
*/
var isAnagram = function(s, t) {
let freq = {};
for (let c of s) freq[c] = (freq[c] || 0) + 1;
for (let c of t) {
if(!freq[c] || freq[c] === 0){
return false;
}
freq[c] = freq[c] - 1;
}
return true;
};
@@ -0,0 +1,59 @@
/*
* 387. First Unique Character in a String
* Difficulty: Easy
* https://leetcode.com/problems/first-unique-character-in-a-string/
*
* ──────────────────────────────────────────────────
*
* Given a string s, find the first non-repeating character in it and
* return its index. If it does not exist, return -1.
*
*
*
* Example 1:
*
* Input: s = "leetcode"
*
* Output: 0
*
* Explanation:
*
* The character 'l' at index 0 is the first character that does not
* occur at any other index.
*
* Example 2:
*
* Input: s = "loveleetcode"
*
* Output: 2
*
* Example 3:
*
* Input: s = "aabb"
*
* Output: -1
*
*
*
* Constraints:
*
* • 1 <= s.length <= 10^5
*
* • s consists of only lowercase English letters.
*/
/**
* @param {string} s
* @return {number}
*/
var firstUniqChar = function (s) {
const freq = {};
for (let c of s) freq[c] = (freq[c] || 0) + 1;
for (let i = 0; i < s.length; i++) {
if (freq[s[i]] === 1) {
return i;
}
}
return -1;
};