File tree Expand file tree Collapse file tree 4 files changed +45
-5
lines changed Expand file tree Collapse file tree 4 files changed +45
-5
lines changed Original file line number Diff line number Diff line change 11# LeetCode Algorithms
22
3- ![ problems-solved] ( https://img.shields.io/badge/Problems%20Solved-174 /2081-1f425f.svg )
4- ![ problems-solved-java] ( https://img.shields.io/badge/Java-174 /2081-1abc9c.svg )
5- ![ problems-solved-python] ( https://img.shields.io/badge/Python-174 /2081-1abc9c.svg )
3+ ![ problems-solved] ( https://img.shields.io/badge/Problems%20Solved-175 /2081-1f425f.svg )
4+ ![ problems-solved-java] ( https://img.shields.io/badge/Java-175 /2081-1abc9c.svg )
5+ ![ problems-solved-python] (https://img.shields.io/badge/Python-175 /2081-1abc9c.svg)
66[ ![ PRs Welcome] ( https://img.shields.io/badge/PRs-welcome-brightgreen.svg )] ( CONTRIBUTING.md )
77[ ![ cp] ( https://img.shields.io/badge/also%20see-Competitve%20Programming-1f72ff.svg )] ( https://github.com/anishLearnsToCode/competitive-programming )
88
195195| 704 | [ Binary Search] ( https://leetcode.com/problems/binary-search ) | [ ![ Java] ( assets/java.png )] ( src/BinarySearch.java ) [ ![ Python] ( assets/python.png )] ( python/binary_search.py ) |
196196| 705 | [ Design HashSet] ( https://leetcode.com/problems/design-hashset ) | [ ![ Java] ( assets/java.png )] ( src/DesignHashSet.java ) [ ![ Python] ( assets/python.png )] ( python/design_hash_set.py ) |
197197| 706 | [ Design HashMap] ( https://leetcode.com/problems/design-hashmap ) | [ ![ Java] ( assets/java.png )] ( src/DesignHashMap.java ) [ ![ Python] ( assets/python.png )] ( python/design_hash_map.py ) |
198- | 709 | [ To Lower Case] ( https://leetcode.com/problems/to-lower-case ) | |
198+ | 709 | [ To Lower Case] ( https://leetcode.com/problems/to-lower-case ) | [ ![ Java ] ( assets/java.png )] ( src/ToLowerCase.java ) [ ![ Python ] ( assets/python.png )] ( python/to_lower_case.py ) |
199199| 716 | [ Max Stack] ( https://leetcode.com/problems/max-stack ) | |
200200| 717 | [ 1-bit and 2-bit Characters] ( https://leetcode.com/problems/1-bit-and-2-bit-characters ) | |
201201| 720 | [ Longest Word in Dictionary] ( https://leetcode.com/problems/longest-word-in-dictionary ) | |
Original file line number Diff line number Diff line change 1+ class Solution :
2+ def isAlphabet (self , character : str ) -> bool :
3+ return self .isUpperCase (character ) or self .isLowerCase (character )
4+
5+ def isUpperCase (self , character : str ) -> bool :
6+ return 65 <= ord (character ) <= 90
7+
8+ def isLowerCase (self , character : str ) -> bool :
9+ return 97 <= ord (character ) <= 122
10+
11+ def toLowerCase (self , s : str ) -> str :
12+ result = ''
13+ for character in s :
14+ result += chr (ord (character ) + 32 ) if self .isAlphabet (character ) and self .isUpperCase (character ) else character
15+ return result
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ private void initializeBuckets() {
4040 }
4141 }
4242
43- private static class Bucket {
43+ private class Bucket {
4444 Queue <Integer > list = new LinkedList <>();
4545
4646 public boolean contains (int element ) {
Original file line number Diff line number Diff line change 1+ public class ToLowerCase {
2+ public String toLowerCase (String s ) {
3+ StringBuilder result = new StringBuilder ();
4+ for (int index = 0 ; index < s .length () ; index ++) {
5+ result .append (toLowerCase (s .charAt (index )));
6+ }
7+ return result .toString ();
8+ }
9+
10+ private char toLowerCase (char character ) {
11+ return isUpperCase (character ) && isAlphabet (character ) ? (char ) (character + 32 ) : character ;
12+ }
13+
14+ private boolean isAlphabet (char character ) {
15+ return isUpperCase (character ) || isLowerCase (character );
16+ }
17+
18+ private boolean isLowerCase (char character ) {
19+ return 97 <= character && character <= 122 ;
20+ }
21+
22+ private boolean isUpperCase (char character ) {
23+ return 65 <= character && character <= 90 ;
24+ }
25+ }
You can’t perform that action at this time.
0 commit comments