Skip to content
Discussion options

You must be logged in to vote

@LPenny-github

你好 😊


            int inputStringLength = inputString.Length;

個人感覺 inputString.Length 已經很清楚,可以選擇不再另外宣告一個 inputStringLength 😊


            HashSet<char> substring = new HashSet<char>();

這裡我會用 charSet 取代 substring ,因為 "string" 會引導讀者往「這是個 string 物件」的方向去想 (但它事實上是個 HashSet


這段與命名無關;這裡的 tailIndex- headIndex + 1 可以用 substring.Count 代替。

                    longestSubstringLength = Math.Max(longestSubstringLength, tailIndex- headIndex + 1);

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@LPenny-github
Comment options

Answer selected by LPenny-github
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants