美文网首页
20190407_week_01

20190407_week_01

作者: 尼嗒叶 | 来源:发表于2019-04-08 01:41 被阅读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引用了上面的话表达观点。

  • How do I structure my code?
  • Why write a function?
  • What’s the use case of a variable?
  • How do I detect when a user taps a button?
  • How do I build a user interface?
    最后,Sam建议swift学习到应用的过程中,常思考这些问题能快速应用到项目中来。

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

Flex-box的了解学习

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

What’s Revolutionary about Flutter

相关文章

  • 20190407_week_01

    Algorithm、Review、Tip、Share 1.每周至少做一个 leetcode 的算法题 1. Two...

网友评论

      本文标题:20190407_week_01

      本文链接:https://www.haomeiwen.com/subject/ptdsiqtx.html