問題
https://leetcode.com/problems/implement-strstr/
解いた
# @param {String} haystack # @param {String} needle # @return {Integer} def str_str(haystack, needle) return -1 unless haystack.include? needle haystack.index(needle) end
結果
https://leetcode.com/problems/implement-strstr/
# @param {String} haystack # @param {String} needle # @return {Integer} def str_str(haystack, needle) return -1 unless haystack.include? needle haystack.index(needle) end