☕ Drones are blowing up
A Google Interview Question. Using Drones to inspect bridges. A new version of Python is out!
Hey,
Hope you’re having an awesome day!
Here’s your Interview Problem and Industry News for the day!
Interview Problem
Given a Palindromic string, replace exactly one character in the string by any lowercase letter so that the string becomes the lexicographically smallest possible string that isn’t a palindrome.
Examples
Input - “racecar”
Output - "aacecar"
Input - "zzzzzzzzz"
Output - "azzzzzzzz"
We’ll send out the solution (with working code & test-cases) tomorrow, so make sure you move our emails to primary, so you don’t miss them!
Gmail users—move us to your primary inbox
On your phone? Hit the 3 dots at top right corner, click "Move to" then "Primary"
On desktop? Back out of this email then drag and drop this email into the "Primary" tab near the top left of your screen
Apple mail users—tap on our email address at the top of this email (next to "From:" on mobile) and click “Add to VIPs”
Industry News
Python 3.9 is here - Python 3.9 was released on October 5th. One of the coolest features is support for the IANA time zone database in the standard library. Another cool feature is the addition of Topological Sorting to graphlib, a module to operate graph data structures. Merging dictionaries just got a lot easier with new union operators for dicts and type hinting has gotten some new updates. Lot’s of awesome stuff!
Skydio gets FAA approval to conduct bridge inspections with drones - There’s currently an explosion in the “drones for industrial use” scene. People are using drones for firefighting, search and rescue and now Skydio wants to use drones to inspect bridges. According to the American Road & Transportation Builders Association, nearly 231,000 U.S. Bridges need major repair work or have to be replaced, that’s 37% of all U.S. bridges. Inspecting those bridges is an expensive and tedious process, but Skydio can reduce the costs by 75% by utilizing drones. The drone inspections also provide superior data and reporting.
Skydio drones use six 4K cameras to record their environment and build a 3D map of their surroundings. They utilize deep learning for object and scene recognition (based off pixel data from the cameras) and AI algorithms for motion planning and obstacle avoidance. They plan on also selling their drones to police departments for public safety and and to the U.S. Military for defense use-cases.
In terms of their tech-stack, their backend software is primarily written in Python, using Flask, SQLAlchemy, Postgres and Redis. The front end is written in TypeScript and they use C++ for the embedded systems with the drones.
Previous Solution
As a refresher, here’s the previous question
Given a string IP, return "IPv4" if IP is a valid IPv4 address, "IPv6" if IP is a valid IPv6 address or "Neither" if IP is not a correct IP of any type.
Solution
There isn’t really a clever way to solve this question. The best we can do is the “brute force” solution.
If you’re familiar with Regex, you can write a Regex Expression to check if the string is an IPv4 or IPv6 address.
Otherwise, the way to solve this would be to split the string by the periods. Then, check each individual part of the IP address and make sure they conform to the requirements of IPv4 or IPv6.
The time complexity is O(1), since the string can be at most 45 characters (if it’s IPv6). If it’s longer than 45 characters than we can just return False.