teleren/devto huggingface dataset:
Funny Girl' as She Leaves the Broadway
Tags: love, motive, beginners
Published: 2022-07-14 15:25:02

Jane Lynch Speaks Out on Lea Michele Joining 'Funny Girl' as She Leaves the Broadway Show
Jane Lynch Speaks Out on Lea Michele Joining 'Funny Girl' as She Leaves the Broadway Show **[sad shayari](https://www.shayari.tech/sad-shayari)**

Jane Lynch has nothing but love for Lea Michele. The 61-year-old actress spoke to Deadline on Tuesday about recent news that Michele had been cast as Beanie Feldstein's replacement as Fanny Brice in the Broadway revival of Funny Girl.

“We have been in touch about it,” Lynch said before addressing her own departure from Funny Girl as Fanny's mother, Rose Brice, and her replacement Tovah Feldshuh. “You know, it was just a really strong idea to have Feldshuh and Lea premiere together. That’s the only reason [we won’t appear together.]"

"I adore her," Lynch added of Michele, whom she starred alongside on Glee from 2009 to 2015. "She’s just going to take this show and make it her own. I’m so glad she’s getting the opportunity in real life to do the show and not just on Glee."

News that Michele is set to replace Feldstein and Feldshuh to take Lynch's place came on Monday. The 35-year-old actress gushed over the opportunity on Instagram later that day.

"A dream come true is an understatement," Michele wrote. "I’m so incredibly honored to join this amazing cast and production and return to the stage playing Fanny Brice on Broadway. See you September 6th."

Feldshuh also took to Instagram, writing, "Thrilled to be with the brilliant deserving Lea Michele in this new journey!"

Feldstein announced her departure from the show in an Instagram post on July 10. 

"Playing Fanny Brice on Broadway has been a lifelong dream of mine, and doing so for the last few months has been a great joy and true honor," she wrote. "Once the production decided to take the show in a different direction, I made the extremely difficult decision to step away sooner than anticipated."

"I will never forget this experience and from the bottom of my heart, I want to thank every single person who came to the August Wilson for the love and support you have shown me and our amazing cast and crew," she continued. "The people I have had the great joy of bringing Funny Girl to life with every night, both on and off the stage, are all remarkably talented and exceptional humans and I hope you continue to join them on Henry Street after I depart on July 31st."

The role of Fanny Brice was first brought to life by Barbra Streisand in the original installment of Funny Girl which premiered on Broadway in 1964.[Zindagi Sad Shayari](https://www.romanticcampus.com/zindagi-sad-shayari/)
[tik tok funny](https://www.youtube.com/shorts/ZemNXymsXvk)
HTML table sticky header with borders
Tags: html, table, header, css
Published: 2022-07-14 16:06:16

---
title: HTML table sticky header with borders
published: true
date: 2022-07-14 15:24:37 UTC
tags: html, table, header,css
canonical_url: https://krzysztofzuraw.com/2022/html-table-sticky-header-with-borders/
---

I recently had to create an HTML table with a sticky header. It turns out you need this piece of CSS to make it work:

```css
thead {
  position: sticky;
  top: 0;
  background: white;
  text-align: left;
}
```

Which is fine and awesome - but what if your header needs to have a border at the bottom? Adding `border-bottom` property won't work if header is sticky. After a few trial and error hours I found out (with help of Mateusz) that you can add empty table row under your table head:

```html
<tr>
  <th style="height:1px; padding:0px; color:black" colspan="6"></th>
</tr>
```

See this in action in this Codepen:

{% codepen https://codepen.io/krzysztofzuraw/pen/eYMBJod %}
Printing formatted things in Go with Printf()
Tags: go, beginners, programming
Published: 2022-07-14 15:24:36

Go allows formatting things and printing them using `Printf()` function (as well as most of other languages). The function is a part of `fmt` package and works exactly the same as in all other langs:

```go
package main
import "fmt"

func main() {
  fmt.Printf("%d", 123) // 123
}
```

Here we've printed `123` value as number (`%d`).

### Printing padded numbers
Sometimes you might want to pad numbers with zeros:

```go
fmt.Printf("%05d", 123) // 00123
```

Which will give `00123` (left pad given number to 5 symbols and using zeros to fill).

### Printing booleans
For boolean variables `%t` format can be used to get text representation:

```go
fmt.Printf("%t", true) // true
fmt.Printf("%t", false) // false
```

[Sprintf()](https://onelinerhub.com/golang/formatting-strings-with-sprintf-example) works like `Printf()`, but returns a string instead of printing it.

[Good tutorial and cheat-sheet](https://yourbasic.org/golang/fmt-printf-reference-cheat-sheet/) on possible format options.
833. Leetcode Solution in Cpp
Tags: cpp
Published: 2022-07-14 15:24:07

```
class Solution {
 public:
  string findReplaceString(string s, vector<int>& indices,
                           vector<string>& sources, vector<string>& targets) {
    vector<pair<int, int>> sortedIndices;

    for (int i = 0; i < indices.size(); ++i)
      sortedIndices.emplace_back(indices[i], i);

    sort(rbegin(sortedIndices), rend(sortedIndices));

    for (const auto& [index, i] : sortedIndices) {
      const string& source = sources[i];
      const string& target = targets[i];
      if (s.substr(index, source.length()) == source)
        s = s.substr(0, index) + target + s.substr(index + source.length());
    }

    return s;
  }
};
```
#leetcode
#challenge
Here is the link for the problem:
https://leetcode.com/problems/find-and-replace-in-string/
Automatically like all rides from other users initially loaded on your Strava dashboard
Tags: tampermonkey, strava
Published: 2022-07-14 15:23:56

```
// ==UserScript==
// @name         Strava like all
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://www.strava.com/dashboard
// @icon         https://www.google.com/s2/favicons?sz=64&domain=strava.com
// @require      http://code.jquery.com/jquery-3.4.1.min.js
// @grant        none
// ==/UserScript==

(function() {
    'use strict';


jQuery( document ).ready(function() {
    setTimeout(function() {
        console.log('Liking ' + jQuery('button[title="Give kudos"]').length + ' new rides');
        jQuery('button[title="Give kudos"]').each(function(i,e) {
            jQuery(e).click();
        });
    },5000);
});
})();
```
825. Leetcode Solution in Cpp
Tags: cpp
Published: 2022-07-14 15:23:12

```
class Solution {
 public:
  int numFriendRequests(vector<int>& ages) {
    int ans = 0;
    unordered_map<int, int> count;

    for (const int age : ages)
      ++count[age];

    for (const auto& [ageA, countA] : count)
      for (const auto& [ageB, countB] : count)
        if (request(ageA, ageB))
          if (ageA == ageB)
            ans += countA * (countB - 1);
          else
            ans += countA * countB;

    return ans;
  }

 private:
  bool request(int ageA, int ageB) {
    return !(ageB <= 0.5 * ageA + 7 || ageB > ageA || ageB > 100 && ageA < 100);
  }
};
```
#leetcode
#challenge
Here is the link for the problem:
https://leetcode.com/problems/friends-of-appropriate-ages/
816. Leetcode Solution in Cpp
Tags: cpp
Published: 2022-07-14 15:22:14

```
class Solution {
 public:
  vector<string> ambiguousCoordinates(string S) {
    vector<string> ans;
    S = S.substr(1, S.length() - 2);

    for (int i = 1; i < S.length(); ++i)
      for (const string& x : splits(S.substr(0, i)))
        for (const string& y : splits(S.substr(i)))
          ans.push_back('(' + x + ", " + y + ')');

    return ans;
  }

 private:
  vector<string> splits(const string& S) {
    if (S.empty() || S.length() > 1 && S.front() == '0' && S.back() == '0')
      return {};
    if (S.back() == '0')
      return {S};
    if (S.front() == '0')
      return {"0." + S.substr(1)};

    vector<string> candidates{S};
    for (int i = 1; i < S.length(); ++i)
      candidates.push_back(S.substr(0, i) + '.' + S.substr(i));
    return candidates;
  }
};
```
#leetcode
#challenge
Here is the link for the problem:
https://leetcode.com/problems/ambiguous-coordinates/
813. Leetcode Solution in Cpp
Tags: cpp
Published: 2022-07-14 15:20:56

```
class Solution {
 public:
  double largestSumOfAverages(vector<int>& nums, int K) {
    const int n = nums.size();
    // dp[i][k] := largest score to partition first i nums into k groups
    dp.resize(n + 1, vector<double>(K + 1));
    prefix.resize(n + 1);

    partial_sum(begin(nums), end(nums), begin(prefix) + 1);
    return largestSumOfAverages(nums, n, K);
  }

 private:
  vector<vector<double>> dp;
  vector<double> prefix;

  double largestSumOfAverages(const vector<int>& A, int i, int k) {
    if (k == 1)
      return prefix[i] / i;
    if (dp[i][k])
      return dp[i][k];

    // try all possible partitions
    for (int j = k - 1; j < i; ++j)
      dp[i][k] = max(dp[i][k], largestSumOfAverages(A, j, k - 1) +
                                   (prefix[i] - prefix[j]) / (i - j));

    return dp[i][k];
  }
};
```
#leetcode
#challenge
Here is the link for the problem:
https://leetcode.com/problems/largest-sum-of-averages/
808. Leetcode Solution in Cpp
Tags: cpp
Published: 2022-07-14 15:19:26

```
class Solution {
 public:
  double soupServings(int N) {
    return N >= 4800 ? 1.0 : dfs((N + 24) / 25, (N + 24) / 25);
  }

 private:
  vector<vector<double>> memo =
      vector<vector<double>>(4800 / 25, vector<double>(4800 / 25));

  double dfs(int a, int b) {
    if (a <= 0 && b <= 0)
      return 0.5;
    if (a <= 0)
      return 1.0;
    if (b <= 0)
      return 0.0;
    if (memo[a][b] > 0)
      return memo[a][b];
    return memo[a][b] = 0.25 * (dfs(a - 4, b) +
                                dfs(a - 3, b - 1) +
                                dfs(a - 2, b - 2) +
                                dfs(a - 1, b - 3));
  }
};
```


#leetcode
#challenge
Here is the link for the problem:
https://leetcode.com/problems/soup-servings/
804. Leetcode Solution in Cpp
Tags: cpp
Published: 2022-07-14 15:18:01

```
class Solution {
 public:
  int uniqueMorseRepresentations(vector<string>& words) {
    const vector<string> morse{
        ".-",   "-...", "-.-.", "-..",  ".",   "..-.", "--.",  "....", "..",
        ".---", "-.-",  ".-..", "--",   "-.",  "---",  ".--.", "--.-", ".-.",
        "...",  "-",    "..-",  "...-", ".--", "-..-", "-.--", "--.."};
    unordered_set<string> transformations;

    for (const string& word : words) {
      string transformation;
      for (const char c : word)
        transformation += morse[c - 'a'];
      transformations.insert(transformation);
    }

    return transformations.size();
  }
};
```

#leetcode
#challenge
Here is the link for the problem:
https://leetcode.com/problems/unique-morse-code-words/
807. Leetcode Solution in Cpp
Tags: cpp
Published: 2022-07-14 15:17:05

```
class Solution {
 public:
  int maxIncreaseKeepingSkyline(vector<vector<int>>& grid) {
    const int n = grid.size();
    int ans = 0;
    vector<int> rowMax(n);
    vector<int> colMax(n);

    for (int i = 0; i < n; ++i)
      for (int j = 0; j < n; ++j) {
        rowMax[i] = max(rowMax[i], grid[i][j]);
        colMax[j] = max(colMax[j], grid[i][j]);
      }

    for (int i = 0; i < n; ++i)
      for (int j = 0; j < n; ++j)
        ans += min(rowMax[i], colMax[j]) - grid[i][j];

    return ans;
  }
};
```
#leetcode
#challenge
Here is the link for the problem:
https://leetcode.com/problems/max-increase-to-keep-city-skyline/
832. Leetcode Solution in Cpp
Tags: cpp
Published: 2022-07-14 15:16:07

```
class Solution {
 public:
  vector<vector<int>> flipAndInvertImage(vector<vector<int>>& A) {
    const int n = A.size();

    for (int i = 0; i < n; ++i)
      for (int j = 0; j < (n + 1) / 2; ++j) {
        const int temp = A[i][j];
        A[i][j] = A[i][n - j - 1] ^ 1;
        A[i][n - j - 1] = temp ^ 1;
      }

    return A;
  }
};
```
#leetcode
#challenge
Here is the link for the problem:
https://leetcode.com/problems/flipping-an-image/
848. Leetcode Solution in Cpp
Tags: cpp
Published: 2022-07-14 15:15:08

```
class Solution {
 public:
  string shiftingLetters(string s, vector<int>& shifts) {
    string ans;

    for (int i = shifts.size() - 2; i >= 0; --i)
      shifts[i] = (shifts[i] + shifts[i + 1]) % 26;

    for (int i = 0; i < s.length(); ++i)
      ans += (s[i] - 'a' + shifts[i]) % 26 + 'a';

    return ans;
  }
};
```


#leetcode
#challenge
Here is the link for the problem:
https://leetcode.com/problems/shifting-letters/
865. Leetcode Solution in Cpp
Tags: cpp
Published: 2022-07-14 15:14:12

```
struct T {
  TreeNode* lca;
  int depth;
};

class Solution {
 public:
  TreeNode* subtreeWithAllDeepest(TreeNode* root) {
    return dfs(root).lca;
  }

 private:
  T dfs(TreeNode* root) {
    if (!root)
      return {nullptr, 0};

    T l = dfs(root->left);
    T r = dfs(root->right);
    if (l.depth > r.depth)
      return {l.lca, l.depth + 1};
    if (l.depth < r.depth)
      return {r.lca, r.depth + 1};
    return {root, l.depth + 1};
  }
};
```
#leetcode
#challenge
Here is the link for the problem:
https://leetcode.com/problems/smallest-subtree-with-all-the-deepest-nodes/
887. Leetcode Solution in Java
Tags: java
Published: 2022-07-14 15:12:57

```
class Solution {
  public int superEggDrop(int k, int n) {
    int moves = 0;
    int[][] dp = new int[n + 1][k + 1];

    while (dp[moves][k] < n) {
      ++moves;
      for (int eggs = 1; eggs <= k; ++eggs)
        dp[moves][eggs] = dp[moves - 1][eggs - 1] + dp[moves - 1][eggs] + 1;
    }

    return moves;
  }
}
```
#leetcode
#challenge
Here is the link for the problem:
https://leetcode.com/problems/super-egg-drop/
Weekly Challenge 173
Tags: perl, python, theweeklychallenge
Published: 2022-07-14 13:15:42

Two pretty straight forward tasks this week. This is good given how challenging my day job has been recently.

[Challenge](https://theweeklychallenge.org/blog/perl-weekly-challenge-173/), [My solutions](https://github.com/manwar/perlweeklychallenge-club/tree/master/challenge-173/sgreen)

## Task 1: Esthetic Number

### Task

You are given a positive integer, `$n`.

Write a script to find out if the given number is Esthetic Number. An esthetic number is a positive integer where every adjacent digit differs from its neighbor by 1.

## My solution

One of the main difference between Python and Perl (other than the syntax) is variables are typed in Python where they aren't in vanilla Perl (I'm excluding Moose like variables here). This always means there is a little extra work required in Python to get the right solution.

For this challenge, I simply loop from the first character to the second last character. I compare the absolute difference (using the `abs` function) between that character and the next one. If the difference is not 1, we know the number is not esthetic, and can print `0` and exit the loop. If we reach the end of the loop, we can print `1`.

## Examples

```
$ ./ch-1.py 5456
1

$ ./ch-1.py 120
0
```

## Task 2: Sylvester’s sequence

### Task

Write a script to generate first 10 members of [Sylvester's sequence](https://en.wikipedia.org/wiki/Sylvester%27s_sequence).

## My solution

The big issue with this challenge is that the numbers involved are very large, and most importantly > 2<sup>31</sup>-1. Python will automatically convert an integer into a long and play along nicely.

For the Perl solution, using [Math::BigInt](https://metacpan.org/pod/Math::BigInt) will achieve the same outcome.

In my code, I seed the `solutions` list (array in Perl) with S<sub>0</sub> of `2`. I then have a loop that iterates until there are 10 values in the list. For each iteration, I take the product of the current values, and add one.

In the Python code, I use `math`s [prod](https://docs.python.org/3/library/math.html#math.prod) function, while I list `List::Util`s [product](https://metacpan.org/pod/List::Util#product) function in my Perl code.

## Examples

```
$ ./ch-2.py 
2
3
7
43
1807
3263443
10650056950807
113423713055421844361000443
12864938683278671740537145998360961546653259485195807
165506647324519964198468195444439180017513152706377497841851388766535868639572406808911988131737645185443
```
890. Leetcode Solution in Cpp
Tags: cpp
Published: 2022-07-14 15:11:47

```
class Solution {
 public:
  vector<string> findAndReplacePattern(vector<string>& words, string pattern) {
    vector<string> ans;

    for (const string& word : words)
      if (isIsomorphic(word, pattern))
        ans.push_back(word);

    return ans;
  }

 private:
  bool isIsomorphic(const string& w, const string& p) {
    vector<int> map_w(128);
    vector<int> map_p(128);

    for (int i = 0; i < w.length(); ++i) {
      if (map_w[w[i]] != map_p[p[i]])
        return false;
      map_w[w[i]] = i + 1;
      map_p[p[i]] = i + 1;
    }

    return true;
  }
};
```
#leetcode
#challenge
Here is the link for the problem:
https://leetcode.com/problems/find-and-replace-pattern/
Programming Challenges
Tags: swift, 100daysofcode, beginners, javascript
Published: 2022-07-14 15:11:00

I've taken the challenge! 

Hi, I'm Shanice and I'm currently completing the #100daysofcode challenge. I'm also working through the #100DaysofSwiftUI program. As a reinforcement for my learning, I'm going to (attempt to) make some challenges with the topics or concepts I've learned. The challenges may be either in Swift, JavaScript, CSS, or HTML. They'll start off simple and increase in difficulty as I continue to learn. If you're learning any of these technologies, feel free to join me by working the challenges or even adding your own 😊. 

✨ Happy Studies ✨
892. Leetcode Solution in Cpp
Tags: cpp
Published: 2022-07-14 15:10:10

```
class Solution {
 public:
  int surfaceArea(vector<vector<int>>& grid) {
    int ans = 0;

    for (int i = 0; i < grid.size(); ++i)
      for (int j = 0; j < grid.size(); ++j) {
        if (grid[i][j])
          ans += grid[i][j] * 4 + 2;
        if (i)
          ans -= min(grid[i][j], grid[i - 1][j]) * 2;
        if (j)
          ans -= min(grid[i][j], grid[i][j - 1]) * 2;
      }

    return ans;
  }
};
```
#leetcode
#challenge
Here is the link for the problem:
https://leetcode.com/problems/surface-area-of-3d-shapes/
Simple Golang HTTP server example
Tags: go, beginners, programming, example
Published: 2022-07-14 15:09:28

Creating HTTP server in Go is as simple as:

```go
package main
import ( "fmt"; "net/http" )

func hi(w http.ResponseWriter, req *http.Request) {
  fmt.Fprintf(w, "Oh hi!\n")
}

func main() {
  http.HandleFunc("/hi", hi)
  http.ListenAndServe(":8222", nil)
}
```

### http.ListenAndServe(":8222", nil)
Here we've created simple server listening for requests on `8222` port of our machine. This is available from `net/http` package.

### http.HandleFunc("/hi", hi)
This asks Go to handle all `/hi` requests with `hi()` function.

### func hi()
This function just answers to any HTTP request with `Oh hi!` text. We use `fmt.Fprintf` to write text to `http.ResponseWriter`.

You might also want to know how to [get client ip](https://onelinerhub.com/golang/how-to-get-client-ip-from-http-server), [query parameters values](https://onelinerhub.com/golang/how-to-get-query-param-from-http-server) or work with [request body](https://onelinerhub.com/golang/how-to-get-request-body-from-http-server).
893. Leetcode Solution in Cpp
Tags: cpp
Published: 2022-07-14 15:09:13

```
class Solution {
 public:
  int numSpecialEquivGroups(vector<string>& A) {
    unordered_set<string> set;

    for (const string& s : A) {
      string even;
      string odd;
      for (int i = 0; i < s.length(); ++i)
        if (i % 2 == 0)
          even += s[i];
        else
          odd += s[i];
      sort(begin(even), end(even));
      sort(begin(odd), end(odd));
      set.insert(even + odd);
    }

    return set.size();
  }
};
```
#leetcode
#challenge
Here is the link for the problem:
https://leetcode.com/problems/groups-of-special-equivalent-strings/
894. Leetcode Solution in Cpp
Tags: cpp
Published: 2022-07-14 15:08:13

```
class Solution {
 public:
  vector<TreeNode*> allPossibleFBT(int n) {
    if (n % 2 == 0)
      return {};
    if (n == 1)
      return {new TreeNode(0)};
    if (memo.count(n))
      return memo[n];

    vector<TreeNode*> ans;

    for (int leftCount = 0; leftCount < n; ++leftCount) {
      const int rightCount = n - 1 - leftCount;
      for (TreeNode* left : allPossibleFBT(leftCount))
        for (TreeNode* right : allPossibleFBT(rightCount)) {
          ans.push_back(new TreeNode(0));
          ans.back()->left = left;
          ans.back()->right = right;
        }
    }

    return memo[n] = ans;
  }

 private:
  unordered_map<int, vector<TreeNode*>> memo;
};
```

#leetcode
#challenge
Here is the link for the problem:
https://leetcode.com/problems/all-possible-full-binary-trees/
944. Leetcode Solution in Cpp
Tags: cpp
Published: 2022-07-14 15:06:35

```
class Solution {
 public:
  int minDeletionSize(vector<string>& A) {
    const int n = A[0].length();
    int ans = 0;

    for (int j = 0; j < n; ++j)
      for (int i = 0; i + 1 < A.size(); ++i)
        if (A[i][j] > A[i + 1][j]) {
          ++ans;
          break;
        }

    return ans;
  }
};
```
#leetcode
#challenge
Here is the link for the problem:
https://leetcode.com/problems/delete-columns-to-make-sorted/
1002. Leetcode Solution in Cpp
Tags: cpp
Published: 2022-07-14 15:05:10

```
class Solution {
 public:
  vector<string> commonChars(vector<string>& A) {
    vector<string> ans;
    vector<int> commonCount(26, INT_MAX);

    for (const string& a : A) {
      vector<int> count(26);
      for (char c : a)
        ++count[c - 'a'];
      for (int i = 0; i < 26; ++i)
        commonCount[i] = min(commonCount[i], count[i]);
    }

    for (char c = 'a'; c <= 'z'; ++c)
      for (int i = 0; i < commonCount[c - 'a']; ++i)
        ans.push_back(string(1, c));

    return ans;
  }
};
```
#leetcode
#challenge
Here is the link for the problem:
https://leetcode.com/problems/find-common-characters/
1019. Leetcode Solution in Cpp
Tags: cpp
Published: 2022-07-14 15:04:12

```
/**
 * Definition for singly-linked list.
 * struct ListNode {
 *     int val;
 *     ListNode *next;
 *     ListNode() : val(0), next(nullptr) {}
 *     ListNode(int x) : val(x), next(nullptr) {}
 *     ListNode(int x, ListNode *next) : val(x), next(next) {}
 * };
 */
class Solution {
 public:
  vector<int> nextLargerNodes(ListNode* head) {
    vector<int> ans;
    stack<int> stack;

    for (; head; head = head->next) {
      while (!stack.empty() && head->val > ans[stack.top()]) {
        int index = stack.top();
        stack.pop();
        ans[index] = head->val;
      }
      stack.push(ans.size());
      ans.push_back(head->val);
    }

    for (; !stack.empty(); stack.pop())
      ans[stack.top()] = 0;

    return ans;
  }
};
```
#leetcode
#challenge
Here is the link for the problem:
https://leetcode.com/problems/next-greater-node-in-linked-list/
1018. Leetcode Solution in Cpp
Tags: cpp
Published: 2022-07-14 15:03:02

```
class Solution {
 public:
  vector<bool> prefixesDivBy5(vector<int>& A) {
    vector<bool> ans;
    int num = 0;

    for (int a : A) {
      num = (num * 2 + a) % 5;
      ans.push_back(num % 5 == 0);
    }

    return ans;
  }
};
```

#leetcode
#challenge
Here is the link for the problem:
https://leetcode.com/problems/binary-prefix-divisible-by-5