-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1108. Defanging an IP Address #73
Comments
我有時候也會遇到這種情況,會覺得ipAddress跟address比起來,ipAddress有重複上下文的感覺(因為function name已有或class name有), |
我還沒有很完整的想法,以下是我想到的兩個方向: 附加的字是否「太多」 (使得資訊變雜訊) ?以這個案例來說,在 有的時候,加字會變成 3 個字,例如 有的時候,加字會變成 4 個字,那就會有 n 種讀法,變得很複雜,整個字多半也會太長,這樣子的「加字」大概就會是負面多於正面。 程式碼長度在這個案例來說,的確可以從 |
再麻煩大大給予命名上的建議 orz (註解的部分,猶豫很久後決定不放上來。程式碼很簡單,放註解應該會浪費大大們的時間 XD ) 總之,非常感謝 orz
public string DefangIPaddr(string inputIPAddress)
{
string[] IPNumbersArray = inputIPAddress.Split(".");
string defangedIPAddress = IPNumbersArray[0];
for (int i = 1; i < IPNumbersArray.Length; ++i)
{
defangedIPAddress +=$"[.]{IPNumbersArray[i]}";
}
return defangedIPAddress;
} |
@twy30 非常感謝大大的指教 orz |
找到啦!
|
@lddr99 十分感謝提供資料 😊 |
https://leetcode.com/problems/defanging-an-ip-address/
請參考「刷 LeetCode 練習命名」 #69 😊
The text was updated successfully, but these errors were encountered: