20190407_week_01

2019-04-08  本文已影响0人  尼嗒叶

Algorithm、Review、Tip、Share

1.每周至少做一个 leetcode 的算法题

1. Two Sum

int* twoSum(int* nums, int numsSize, int target) {
      static int targetArray[2] = {0};
      for(int i = 0; i < numsSize - 1; i++){
          for(int j = i + 1; j < numsSize; j++){
                if(nums[i] + nums[j] == target){
                    targetArray[0] = i;
                    targetArray[1] = j;
                    return targetArray;
                }
          }
      }
    return 0;
}
  class Solution {
    func twoSum(_ nums: [Int], _ target: Int) -> [Int] {
        var dict = [Int:Int]()
        
        for index in 0..<nums.count {
            dict[nums[index]] = index 
        }
        
        for i in 0..<nums.count {
            
            var complement = target - nums[i]
            
            if let complementIndex = dict[complement] {
                if complementIndex == i {
                    continue
                } else {
                    return [i,complementIndex]
                }
            }  
        }
        return []
    }
} 

2.阅读并点评至少一篇英文技术文章

最近决定开始学习应用swift到项目中,所以搜了一篇switf学习到应用的文章。
100 Days of Swift: The Tutorials
作者Sam Lu
表示switf非常容易学习,但是要应用到项目中却要解决很多的问题才行,为了分享经验Sam lu花费了6个月专门做了关于swift应用指导的多媒体视频。

“Fundamentals, fundamentals, fundamentals. You’ve got to get the fundamentals down otherwise the fancy stuff isn’t going to work.” ―Randy Pausch, The Last Lecture
对于switf的版本更新,Sam引用了上面的话表达观点。

3.学习至少一个技术技巧

Flex-box的了解学习

4.分享一篇有观点和思考的技术文章

What’s Revolutionary about Flutter

上一篇 下一篇

猜你喜欢

热点阅读