Hello friends!
I hope you had a great week! Mine was very productive. Let's get right to it!
Â
Web links of the week
The Definitive Guide To Protecting Your Eyes For Developers
CSS Grid Sliding Puzzle
Building a Simple Virtual DOM from Scratch
JSON Generator
Â
Something that interested me this week
This past week I found out that an article I wrote was published... in print!! I wrote an article for
Web Designer Magazine about making art with CSS! If I'm being honest, when they approached me and asked for an article, I thought it was for a blog post or some online journal and just didn't ask questions. It was only later that I saw on Twitter that someone had bought and read the magazine that I realized it was a physical copy!
There's something about print that feels that much cooler. Being able to hold it in your hands and own it is so much more satisfying (I imagine this is how physical book readers feel, and those who still buy CDs or DVDs or records).
Anyway, I haven't found a copy of the magazine yet myself, but I'm determined to get one in a physical store, and geek out about it being in print, in person!
Â
Interview question of the week
Last week, I had you reverse words in a string (except for the first and last word)! We had a bunch of great answers. Here's
Kyle's,
Wesley's, and
Rodrigo's!Â
Joe's Python answer:
def revMid(s):
  li = s.split()
  for i in range(1, len(li) - 1):
    li[i] = li[i][::-1]
  return ' '.join(li)
and Sumaiya's Python answer!
example1 = "I want some cake"
example1 = example1.split(' ')
def reverse(word):
  tempList = []
  index = len(word) - 1
  for char in word:
    tempList.append(word[index])
    index -= 1
  separator = ''
  return separator.join(tempList)
def reverse_middle(example):
  last = len(example) - 1  Â
  for word in example1:
    if word == example1[0] or word == example1[last]:
      print(word, end= ' ')
    else:
      print(reverse(word= word), end=' ')
reverse_middle(example= example1)
This week's question:
Given a binary string, write a function that is allowed to do at most one swap between any 0 and 1 to find the length of the longest consecutive 1's that can be achieved.
Example:
binarySwap('111011101')
> 7Â
(Swap the 0 at index 4 with 1 at index 10)
binarySwap('000111')
> 3
(No swaps needed)
Â
Cool things from around the internet
Bloodhound SSC supersonic vehicle
LZ GH V2 with C3 Tangerines Build Stream
Package Thief vs. Glitter Bomb Trap
Â
Joke
Twenty years from now, kids are gonna think the song, "Baby it's Cold Outside" is really weird, and we're gonna have to explain that it has to be understood as a product of its time.
"You see, kid, it used to get cold outside..."
Â
That's all for now, folks! Hope you have a great week. Be safe, make good choices, and stretch your neck right now and fix your posture.
cassidoo