Git Product home page Git Product logo

katapractice's People

Watchers

 avatar  avatar

katapractice's Issues

Band Name reviewed.

一些建議供你參考

  1. 可以試著用C#內建的 TextInfo.ToTitleCase 方法將字首轉為大寫
  2. strWithoutFirst可以嘗試用string.Concat(str.Skip(1)) 可以有同樣效果

TwoSum reviewed

蠻聰明的演算法, 不過我不知道跟在一個迴圈裡用Dictionary去找第二個數字這樣哪一個比較快
可能要看一下OrderBy的複雜度是怎樣

這裡只提出一個小建議參考:
var numsWithOrder = nums.Select((v, i) => new ArrayOrder { Value = v, Order = i });
可以改成匿名型別, 就不需要為了一次性的使用宣告一個class
var numsWithOrder = nums.Select((v, i) => new { Value = v, Order = i });

DeadAnt reviewed

幾點建議如下

  1. MaxCountOfAnt() 裡面的兩個迴圈可以改用linq的GroupBy()跟ToDictionary(), 不過這題GroupBy()完就可以計算了, 不一定要ToDictionary()
  2. UnitTest一次只驗證一件事情, 把多個獨立的Test放在同一個測試裡, 當有錯誤發生時會無法從IDE直接看出是哪一個測試壞掉了
  3. Test Case裡面Kata.DeadAntCount()呼叫了四次, 可以考慮refactor了
  4. 有看到你使用了const, 雖然是在method裡應該不影響, 還是建議你參考一下這篇文章
    https://dotblogs.com.tw/yc421206/archive/2011/06/06/27232.aspx

AverageString reviewed

  1. 可以只用一個Dictionary處理
    如果有兩個, 對照表增加的時候就必須要改兩個, 就有可能出現不一致的地方
    Dictionary也是可以用Value去搜尋的, 只是效率沒有用Key那麼高
    在本次條件下, Key跟Value都是絕對不會重複的, 所以也可以用ToDictionary()去把Key跟Value轉置來使用

  2. magic number & magic string
    "n/a", -1都個別使用了兩次, 可以考慮抽成field

  3. 測試一次只測一件事 & Refactor test code
    把所有的Test case放在同一個Method, 其中一個出錯時較難從IDE直接看出是哪一個
    可以比照其他測試改用NUnit
    Extension.AverageString()呼叫了很多次, 可以考慮抽成共用

  4. 好像漏commit了sln檔

DuplicateCount reviewed

建議如下:

  1. 可以嘗試用LINQ GroupBy()與Count()的方式來實作
  2. 一個TestCase裡面只驗證一個情境, 避免驗證失敗時找不到是哪一個Assert錯了

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.