The Devs Like Us Weekly

Subscribe
Archives
July 5, 2021

📰 "Not everything that is faced can be changed, but nothing can be changed until it is faced." - James Baldwin

Hi DLU crew, I hope everyone enjoyed their 4th and are doing well! As always make sure to take some time to enjoy yourself and make time to be around those you care about, enjoy the newsletter and stay safe.

The Coding Puzzle 🧩

Solution for last week:

class Solution:
    def lengthOfLongestSubstring(self, s: str) -> int:
        n = len(s)
        ans = 0
        # mp stores the current index of a character
        mp = {}

        i = 0
        # try to extend the range [i, j]
        for j in range(n):
            if s[j] in mp:
                i = max(mp[s[j]], i)

            ans = max(ans, j - i + 1)
            mp[s[j]] = j + 1

        return ans

This week's puzzle

Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.

You may assume that each input would have exactly one solution, and you may not use the same element twice.

You can return the answer in any order.

Example 1:

Input: nums = [2,7,11,15], target = 9
Output: [0,1]
Output: Because nums[0] + nums[1] == 9, we return [0, 1].

Example 2:

Input: nums = [3,2,4], target = 6
Output: [1,2]
 Developer Headlines 📢

❇️ NO!! GitHub Copilot Will NOT Steal Your Job

❇️ 3 Phases to a Safe and Successful Cloud Migration

Want to recommend someone for our developer spotlight, developer event, or just say hello? Send us an email at yourfriends@devslike.us we want to hear from you!

 Social 💻

YouTube | Podcast | Instagram | Website | Twitter

The Cast on Twitter: Terrence | Clarence | JB

Well, that's all we have for this week's issue. A quick reminder to add our Podcast on your favorite platform and subscribe to our YouTube page!

Sincerely,

The DLU Team

Don't miss what's next. Subscribe to The Devs Like Us Weekly:
Powered by Buttondown, the easiest way to start and grow your newsletter.