Skip to content

283. Move Zeroes#54

Open
ryosuketc wants to merge 1 commit intomainfrom
283_move_zeroes
Open

283. Move Zeroes#54
ryosuketc wants to merge 1 commit intomainfrom
283_move_zeroes

Conversation

@ryosuketc
Copy link
Owner


元のコード

```cpp

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cpp と python 異なる言語で書くときに気を付けていることありますか?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ここに書いている C++ はコピペなので自分で書いてはいないですが、言語を跨いで portable な概念 (例えば一般的な DSA についてはそうだと思いますが)、言語によって微妙に挙動が違うものが存在するので (e.g. https://github.com/Ryotaro25/leetcode_first60/pull/66#discussion_r2020118072)、そういうのは気にしているように思います。


ただし、この例だと、このような出力になる。C++ `remove` はそのように定義されているので問題ないはずだが、LeetCode の問題としては、最後に `nums[result:] = [0] * (len(nums) - result)` のような処理をする必要がある (`Solution3`)

* Input: [0,1,0,3,12]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LeetCodeでは、テストを書かなくていいですが、
自分のプロジェクトを実際に書くときはテストを書いたりしてますか?
どの頻度で確認するものでしょうか?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

テスト (最低限 unit test) を書かないと commit できないという運用の会社が多いという理解でして、そういう意味では当然テストを書きますね。
Test Driven Development (TDD) のような考えに則るのであれば、ソフトを書く前にテストを書くということになっているので、最初にまとまったテストを書くと思います。

テストケースの選定といえば、category parition method と TSL (Test Specificatoin Language) というのを大学でやったりしましたが、業界的なデファクトな方法論は私もあまり知らないかもしれません。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants