teleren/devto huggingface dataset:
2074. Leetcode Solution in Cpp
Tags: cpp
Published: 2022-07-22 07:00:08

```
class Solution {
 public:
  ListNode* reverseEvenLengthGroups(ListNode* head) {
    // prev -> (head -> ... -> tail) -> next -> ...
    ListNode dummy(0, head);
    ListNode* prev = &dummy;
    ListNode* tail = head;
    ListNode* next = head->next;
    int groupLength = 1;

    while (true) {
      if (groupLength & 1) {
        prev->next = head;
        prev = tail;
      } else {
        tail->next = nullptr;
        prev->next = reverse(head);
        // prev -> (tail -> ... -> head) -> next -> ...
        head->next = next;
        prev = head;
      }
      if (!next)
        break;
      head = next;
      const auto res = getTailAndLength(head, groupLength + 1);
      tail = res.first;
      next = tail->next;
      groupLength = res.second;
    }

    return dummy.next;
  }

 private:
  pair<ListNode*, int> getTailAndLength(ListNode* head, int groupLength) {
    int length = 1;
    ListNode* tail = head;
    while (length < groupLength && tail->next) {
      tail = tail->next;
      ++length;
    }
    return {tail, length};
  }

  ListNode* reverse(ListNode* head) {
    ListNode* prev = nullptr;
    while (head) {
      ListNode* next = head->next;
      head->next = prev;
      prev = head;
      head = next;
    }
    return prev;
  }
};

```


#leetcode
#challenge
Here is the link for the problem:
https://leetcode.com/problems/reverse-nodes-in-even-length-groups/
Python Beginners projects
Tags: beginners, python, codenewbie, tutorial
Published: 2022-07-22 07:00:00

Python is one of the best programming languages. Due to its readability and beginner-friendly nature, it has been accepted by industries around the world. So to master Python for any field you have to work on projects. In this article, I will introduce you to 100+ amazing Python projects with source code solved and explained for free.

**Python Projects For Beginners:**
If you’re a newbie to Python where you’ve just learned lists, tuples, dictionaries, and some basic Python modules like the random module, here are some Python projects with source code for beginners for you:

[1. Count Character Occurrences using Python](https://dev.to/sandeepk27/count-character-occurrences-using-python-14ne)

[2. Pick a Random Card using Python](https://dev.to/sandeepk27/pick-a-random-card-using-python-4p7j)
2079. Leetcode Solution in Python3
Tags: python
Published: 2022-07-22 06:59:21

```
class Solution:
  def wateringPlants(self, plants: List[int], capacity: int) -> int:
    ans = 0
    currCapacity = 0

    for i, plant in enumerate(plants):
      if currCapacity + plant <= capacity:
        currCapacity += plant
      else:
        currCapacity = plant  # reset
        ans += i * 2

    return ans + len(plants)


```
#leetcode
#challenge
Here is the link for the problem:
https://leetcode.com/problems/watering-plants/
Count Character Occurrences using Python
Tags: beginners, tutorial, python, opensource
Published: 2022-07-22 06:57:00

Counting occurrences of a character in a string means counting all substrings of a character from the input string. This is one of the important questions you are asked in the coding interviews. In this article, I’ll walk you through how to count character occurrences using Python.

**Count Character Occurrences using Python:**
To count the occurrences of a character, we need to write an algorithm that returns the number of times each character appears in the input string. The algorithm must iterate through each character from the beginning to count the number of times each character appears in the string. Here’s how to write an algorithm for counting character occurrences using Python:

```
def count_characters(s):
    count = {}
    for i in s:
        if i in count:
            count[i] += 1
        else:
            count[i] = 1
    print(count)
print(count_characters("This is a count occurrences program"))
```

Output:
```
{'T': 1, 'h': 1, 'i': 2, 's': 3, ' ': 5, 'a': 2, 'c': 4, 'o': 3, 'u': 2, 'n': 2, 't': 1, 'r': 4, 'e': 2, 'p': 1, 'g': 1, 'm': 1}
```

In the code above, we step through each character in the input string. If the character is already present in the string, we simply increment the value of the character by 1 and so on. Otherwise, we just add the character in the dictionary and set it to 1. In the end, we get a dictionary with the characters as keys and their values as the number of times they appeared in the string.


**Summary**
Counting the occurrences of a character is an important question for the coding interview. Here we have to write an algorithm to count the number of times each character appears in a string. I hope you liked this article on how to count character occurrences using Python. Feel free to ask your valuable questions in the comments section below.

[Pick a Random Card using Python](https://dev.to/sandeepk27/pick-a-random-card-using-python-4p7j)
2245. Leetcode Solution in Cpp
Tags: cpp
Published: 2022-07-22 06:56:19

```
class Solution {
 public:
  int maxTrailingZeros(vector<vector<int>>& grid) {
    const int m = grid.size();
    const int n = grid[0].size();
    // leftPrefix2[i][j] := # of 2 in grid[i][0..j]
    // leftPrefix5[i][j] := # of 5 in grid[i][0..j]
    // topPrefix2[i][j] := # of 2 in grid[0..i][j]
    // topPrefix5[i][j] := # of 5 in grid[0..i][j]
    vector<vector<int>> leftPrefix2(m, vector<int>(n));
    vector<vector<int>> leftPrefix5(m, vector<int>(n));
    vector<vector<int>> topPrefix2(m, vector<int>(n));
    vector<vector<int>> topPrefix5(m, vector<int>(n));

    for (int i = 0; i < m; ++i)
      for (int j = 0; j < n; ++j) {
        leftPrefix2[i][j] = getCount(grid[i][j], 2);
        leftPrefix5[i][j] = getCount(grid[i][j], 5);
        if (j) {
          leftPrefix2[i][j] += leftPrefix2[i][j - 1];
          leftPrefix5[i][j] += leftPrefix5[i][j - 1];
        }
      }

    for (int j = 0; j < n; ++j)
      for (int i = 0; i < m; ++i) {
        topPrefix2[i][j] = getCount(grid[i][j], 2);
        topPrefix5[i][j] = getCount(grid[i][j], 5);
        if (i) {
          topPrefix2[i][j] += topPrefix2[i - 1][j];
          topPrefix5[i][j] += topPrefix5[i - 1][j];
        }
      }

    int ans = 0;
    for (int i = 0; i < m; ++i)
      for (int j = 0; j < n; ++j) {
        const int curr2 = getCount(grid[i][j], 2);
        const int curr5 = getCount(grid[i][j], 5);
        const int l2 = leftPrefix2[i][j];
        const int l5 = leftPrefix5[i][j];
        const int r2 = leftPrefix2[i][n - 1] - (j ? leftPrefix2[i][j - 1] : 0);
        const int r5 = leftPrefix5[i][n - 1] - (j ? leftPrefix5[i][j - 1] : 0);
        const int t2 = topPrefix2[i][j];
        const int t5 = topPrefix5[i][j];
        const int d2 = topPrefix2[m - 1][j] - (i ? topPrefix2[i - 1][j] : 0);
        const int d5 = topPrefix5[m - 1][j] - (i ? topPrefix5[i - 1][j] : 0);
        ans = max({ans, min(l2 + t2 - curr2, l5 + t5 - curr5),
                   min(r2 + t2 - curr2, r5 + t5 - curr5),
                   min(l2 + d2 - curr2, l5 + d5 - curr5),
                   min(r2 + d2 - curr2, r5 + d5 - curr5)});
      }

    return ans;
  }

 private:
  int getCount(int num, int factor) {
    int count = 0;
    while (num % factor == 0) {
      num /= factor;
      ++count;
    }
    return count;
  }
};

```
#leetcode
#challenge
Here is the link for the problem:
https://leetcode.com/problems/maximum-trailing-zeros-in-a-cornered-path/
2222. Leetcode Solution in Cpp
Tags: cpp
Published: 2022-07-22 06:54:20

```
class Solution {
public:
    long long numberOfWays(string s) {
        long dp[4][2] = {};
        dp[0][0] = dp[0][1] = 1;
        for (int i = 0; i < s.size(); ++i) {
            for (int len = 1; len <= 3; ++len) {
                dp[len][s[i] - '0'] += dp[len - 1][1 - (s[i] - '0')]; // for this s[i], we can prepend subsequences of length `len-1` ending with a different character to it.
            }
        }
        return dp[3][0] + dp[3][1];
    }
};
```

#leetcode
#challenge
Here is the link for the problem:
https://leetcode.com/problems/number-of-ways-to-select-buildings/
2295. Leetcode Solution in Cpp
Tags: cpp
Published: 2022-07-22 06:53:20

```
class Solution {
 public:
  vector<int> arrayChange(vector<int>& nums, vector<vector<int>>& operations) {
    unordered_map<int, int> numToIndex;

    for (int i = 0; i < nums.size(); ++i)
      numToIndex[nums[i]] = i;

    for (const auto& o : operations) {
      const int original = o[0];
      const int replaced = o[1];
      const int index = numToIndex[original];
      nums[index] = replaced;
      numToIndex.erase(original);
      numToIndex[replaced] = index;
    }

    return nums;
  }
};

```
#leetcode
#challenge
Here is the link for the problem:
https://leetcode.com/problems/replace-elements-in-an-array/
Enable inline editing in Workspace lists
Tags: servicenow
Published: 2022-07-22 06:51:00

To activate the inline editing of lists in workspaces, you need to set the property 'glide.lists.inline_editing_enabled' to true. OOTB it is disabled.

1. Go to sys_properties
2. Search for 'glide.lists.inline_editing_enabled'
3. Set the property in the global scope to true

Now you can double click on a list item and directly edit it.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zwmq3du2rtc4bhran2vv.png)
1690. Leetcode Solution in Cpp
Tags: cpp
Published: 2022-07-22 06:48:52

```
class Solution {
 public:
  int stoneGameVII(vector<int>& stones) {
    const int n = stones.size();
    // dp[i][j] := max score you can get more than your opponent in stones[i..j]
    dp.resize(n, vector<int>(n));
    prefix.resize(n + 1);

    partial_sum(begin(stones), end(stones), begin(prefix) + 1);
    return stoneGameVII(stones, 0, n - 1);
  }

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

  int stoneGameVII(const vector<int>& stones, int i, int j) {
    if (i == j)
      return 0;
    if (dp[i][j] > 0)
      return dp[i][j];

    dp[i][j] =
        max({dp[i][j],
             // remove stones[i], so get sum of stones[i + 1..j]
             prefix[j + 1] - prefix[i + 1] - stoneGameVII(stones, i + 1, j),
             // remove stones[j], so get sum of stones[i..j - 1]
             prefix[j] - prefix[i] - stoneGameVII(stones, i, j - 1)});

    return dp[i][j];
  }
};

```

#leetcode
#challenge
Here is the link for the problem:
https://leetcode.com/problems/stone-game-vii/
1846. Leetcode Solution in Python
Tags: python
Published: 2022-07-22 06:47:09

```
class Solution(object):
    def maximumElementAfterDecrementingAndRearranging(self, arr):
        """
        :type arr: List[int]
        :rtype: int
        """
        arr.sort()
        arr[0] = 1
        for i in range(1, len(arr)):
            arr[i] = min(arr[i], arr[i - 1] + 1)
        return arr[-1]
```
#leetcode
#challenge
Here is the link for the problem:
https://leetcode.com/problems/maximum-element-after-decreasing-and-rearranging/
Steps to integrate Razorpay
Tags: payment
Published: 2022-07-22 06:43:30

# Steps to integrate Razorpay 

Update feature testing after updating blog structure updated

* Final Checking on changed blog structure acadcas

* Storing API keys in settings.pyacacascascasc

* c a asd fasdf afdac

* Creating order using Razorpay API.

* Creating order at backend and also creating Razorpay order.

	* Show template

	* render to payment.html

	* Done with creating an order.

### **Uploading a File**

There are three ways you can upload a file:

- From an `Object` instance

- From a `Bucket` instance

- From the `client`

In each case, you have to provide the `Filename`, which is the path of the file you want to upload. You’ll now explore the three alternatives. Feel free to pick whichever you like most to upload the `first_file_name` to S3.

<br/>

![](https://notionpack-uploads.s3.amazonaws.com/blog_images/tmp/tmpo9llzi0n.png)
Tipos
Published: 2022-07-22 06:08:22

Tipos De Letra Grátis
=====================

  

[Tipos De Letra Grátis](https://www.tiposdeletragratis.com/) é um site oficial que fornece fontes gratuitas ilimitadas em apenas um clique. Você precisa selecionar sua fonte favorita e clicar no botão de download. Sua fonte favorita será baixada para o seu dispositivo.
Reformuler_Un_Texte
Published: 2022-07-22 06:07:32

# [REFORMULER UN TEXTE](https://plagiarism-remover.com/reformuler-un-texte.html)

Ne pensez-vous pas que la redaction de contenu est un art et que tout le monde peut etre un artiste ? Il ne fait aucun doute qu'il existe aujourd'hui des tonnes de redacteurs qui se demenent pour fournir un contenu de qualite superieure dans les delais impartis.
Text_Umschreiben
Published: 2022-07-22 06:03:12

Text Umschreiben
================

Beim [Text umschreiben](https://plagiarism-remover.com/text-umschreiben.html) überarbeiten die Autoren ihren Inhalt von Grund auf, um eine bessere Leistung zu erzielen. Ob im akademischen oder im beruflichen Umfeld, das Umschreiben von Artikeln ist oft notwendig. Deshalb ist es wichtig, dass es richtig gemacht wird.

Einer der vielen Gründe, warum Autoren ihren [Text umschreiben](https://plagiarism-remover.com/text-umschreiben.html) müssen, ist die mangelhafte Leistung. Dabei geht es nicht um Überarbeitungen, sondern um das Neuschreiben von Inhalten.
pdf-birlestir
Published: 2022-07-22 05:58:07

PDF birleştirme
---------------

  

[pdf birleştirme](http://www.pdf-birlestir.com/), birden çok PDF'yi tek bir pdf'ye dönüştüren ücretsiz bir çevrimiçi araçtır. '+' simgesine tıklayın, çoklu pdf'nizi seçin ve PDF Birleştirme düğmesine tıklayın. Artık benzersiz dönüştürülmüş pdf'niz otomatik olarak cihazınıza indirilir.

  

PDF nasıl birleştirilir? Ücretsiz PDF Kombinasyon Programı
----------------------------------------------------------

  

Çoğu durumda, PDF dosyalarını birleştirmek, güvenilir PDF okuyucu ve düzenleyici yazılımı satın almayı veya indirmeyi gerektirir. Ancak, bunu hızlı bir şekilde yapmanız gerekiyorsa ve bilgisayarınızda yeterince gelişmiş bir PDF okuyucu yüklü değilse, dosyalarınızı birleştirmenin daha kolay ve ücretsiz bir yolu vardır. Free Combine pdfs ile yazılım satın alıp indirmeniz gerekmez. İnternette PDF dosyalarınızı herhangi bir cihaz ve işletim sistemi ile birleştirmenizi sağlayacak ücretsiz PDF birleştirme araçları bulmak mümkündür.

  

[Pdf Merge](http://www.pdf-birlestir.com/) ile bilgisayarınıza herhangi bir yazılım yüklemenize gerek kalmadan birden fazla PDF belgesini tek bir dosyada hızlı ve kolay bir şekilde birleştirebilirsiniz. Birleştirme pdf'sini kullandığınızda, farklı pdf dosyalarının iyi bir şekilde birleştirildiğinden, iyi organize edildiğinden ve tutarlı olduğundan emin olabilirsiniz. Bu, farklı pdf dosyalarını birleştirirken ilgili tüm belgeleri bulmaya çalışmakla zaman kaybetmenize gerek olmadığı anlamına gelir. PDF belgelerini sırayla birleştirmek mümkündür. İster masaüstünde ister uzakta çalışıyor olun, PDF birleştiricimize herhangi bir web tarayıcısından erişilebilir.

  

  

Pdf birleştirme aracı nasıl kullanılır?
---------------------------------------

  

Aşağıda, birden çok PDF sayfasını tek bir belgede birleştirmenize yardımcı olacak adım adım bir kılavuz bulunmaktadır.

  

  

Başlamak için, toplamayı planladığınız birkaç [PDF belgesi](http://www.pdf-birlestir.com/) yükleyin veya oluşturun.

Birleştirmek istediğiniz dosyaları seçtikten sonra Daha Fazla düğmesini seçin ve hepsini seçtikten sonra PDF Birleştirici'ye tıklayın.

Birleştir düğmesine tıklamadan önce, PDF dosyalarını görünmelerini istediğiniz sırayla düzenlemeniz gerekir. Bunu yapmak için, belgeleri tercih ettiğiniz sırayla sürükleyip bırakmanız yeterlidir. İşiniz bittiğinde, yeni birleştirilen belgeye bir ad verin.

Ayrıca pdf birleştirme ile birleştirdiğiniz belgelerin sayfalarını yeniden düzenleme olanağı sağlar. Açılan açılır pencerede, seçenekler simgesine tıklayarak yeni birleştirilen belgeye dahil etmek istediğiniz sayfaları seçin.

Bundan sonra açılır menüden Şimdi pdf birleştir'i seçin.

  

Belgeleriniz tek bir dosyada birleştirildiğinde, onları indirebilir veya tercih ettiğiniz yöntemi kullanarak istediğiniz buluta kaydedebilirsiniz. Yeni entegre edilen belgenizi Belgelerim sayfasında da bulabilirsiniz.
199. Leetcode Solution in Cpp
Tags: cpp
Published: 2022-07-22 05:56:41

```
class Solution {
 public:
  vector<int> rightSideView(TreeNode* root) {
    if (!root)
      return {};

    vector<int> ans;
    queue<TreeNode*> q{{root}};

    while (!q.empty()) {
      const int size = q.size();
      for (int i = 0; i < size; ++i) {
        TreeNode* node = q.front();
        q.pop();
        if (i == size - 1)
          ans.push_back(node->val);
        if (node->left)
          q.push(node->left);
        if (node->right)
          q.push(node->right);
      }
    }

    return ans;
  }
};

```

#leetcode
#challenge
Here is the link for the problem:
https://leetcode.com/problems/binary-tree-right-side-view/
My first key strokes
Published: 2022-07-22 04:41:52

I was intrigued by computers as early as first grade, when my dad showed me a magazine photo of a computer. "So, if you work on a computer, you basically watch TV all day, right?", I asked my dad. I don't remember what he replied, but I kept a cut-out of that photo. Later, I made a toy computer with a cardboard shoe-box, plastic and a flashlight. "Look, dad. I have a computer now!".

In 3rd grade, we could choose painting, or computers as one of the courses. It was an obvious choice for me. Why on earth would I choose painting? The first "computer class" was all theory and everything flew over my head. "Well, maybe I should have taken painting", I thought. However, things changed the next time when we were taken inside a computer lab. It was full of those early desktops which did not have a hard drive and ran DOS. They had slots for these gigantic floppy disks. I also loved the smell of the air that came out of the air conditioners.

![Our Computer Lab in 2005. It wasn’t much different in 1995.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tkyz4lxd5ramaygyd7gc.jpg)

We were using LOGO, which is a language for drawing. I recommend reading about it. It's a fun one. In a nutshell, you are given a "turtle" with a "pen". Upon your command, the turtle moves around the screen, leaving a trail. I typed a couple of commands which were written on the board:

FD 50
RT 90

Which means, "Move forward 50 pixels, then make a 90-degrees right turn". I didn't care about the output. I was exhilarated at the fact that I just operated a computer. Not a toy one, a real one with a real screen!

"Dad, I operated a computer!", I yelled when I reached home.
101. Leetcode Solution in Cpp
Tags: cpp
Published: 2022-07-22 05:53:36

```
class Solution {
 public:
  bool isSymmetric(TreeNode* root) {
    return isSymmetric(root, root);
  }

 private:
  bool isSymmetric(TreeNode* p, TreeNode* q) {
    if (!p || !q)
      return p == q;

    return p->val == q->val &&
           isSymmetric(p->left, q->right) &&
           isSymmetric(p->right, q->left);
  }
};

```
#leetcode
#challenge
Here is the link for the problem:
https://leetcode.com/problems/symmetric-tree/
XDC Network Released Beta Version of XDPOS 2.0.
Tags: xdc, xdpos2, blockchain, xdcnetwork
Published: 2022-07-22 05:46:17

XinFin XDC Network unveils beta version of its upgraded consensus.
The beta release of XDPoS 2.0, a unique consensus engine created especially for XDC, has been announced by the HashLabs team with great excitement. As indicated by the full year of beta testing which is necessary before the new protocol is scheduled to be introduced in the first quarter of 2023.

The new upgraded version features are Modern Byzantine security safe even if one-third of the master nodes go rouge. only three blocks to complete a transaction due to its lightning-fast final approval. It will Integrated forensic monitoring ensures that attackers will leave behind evidence. An easy transition from 1.0 to 2.0, straightforward deployment, and no need to alter accounts, wallets, or Dapps.

### XDC Network’s Reason For the Updation

The XDPoS 2.0 is actually a significant advancement and is by far the most complex upgrade since the [XDC Network's](https://xinfin.org/) beginnings.  XDPoS 2.0 will continue to be tested up until the beginning of 2023 to make sure the upgrade functions as intended. 

The XDC Network is a longest-chain network that uses a combination of delegated proof of stake and proof of work to protect the network and achieve quick verification utilizing its current XDPoS 1.0 protocol. A hostile takeover is already extremely difficult to carry out since it would require widespread collusion among the holders of validator nodes.

Each of these holders has a financial interest in the network's success because they each own at least 10 million XDC and receive an annual payout of a part of that amount for confirming transactions. Additionally, node operators are dispersed globally and decentralized, and they must go through a know your customer (KYC) process. One can never be too secure, though. 

To that end of the upgrade, [XDPoS 2.0](https://www.xdc.dev/fisher_yu/xdpos-20-beta-release-129h) will undergo intense inspections before it is prepared for mainnet deployment the following year. All upgrades will undergo in-depth testing on test-net and dev-net and there will be pressure testing and simulated assaults. Any discussion on development can be taken to Xdc.dev, which is a blockchain developer resource forum. It serves as a key hub for blockchain developers, including a knowledge base, tools, and assistance.
86. Leetcode Solution in JavaScript
Tags: javascript
Published: 2022-07-22 05:38:06

```
var partition = function(head, x) {
    let fdum = new ListNode(0), bdum = new ListNode(0),
        front = fdum, back = bdum, curr = head
    while (curr) {
        if (curr.val < x)front.next = curr, front = curr
        else back.next = curr, back = curr
        curr = curr.next
    }
    front.next = bdum.next, back.next = null
    return fdum.next
};
```
#leetcode
#challenge
Here is the link for the problem:
https://leetcode.com/problems/partition-list/
Generate dynamic social images the easy way
Published: 2022-07-22 05:26:00

At [staking crypto](https://stakingcrypto.io), we are aiming at comparing the best exchanges for getting the best possible rate on the market for your favorite crypto.

For this, if you follow our [twitter](https://twitter.com/stakingcryptoio), you will always be alerted as soon as a rate increases, or a new coin to stake is discovered.

I'm always sharing a direct link to the coin detail page such as [staking FTM](https://stakingcrypto.io/stake/FTM/fantom) but the social image was only the logo of the crypto, in 64x64, which was not really appealing.

Fordtunately I discovered [This Github repo](https://github.com/tuhinpal/dynamic-image) and forked it to create my own social images, generated on the fly everytime I share a link of my website.

I still remember when I had to use imagemagick to do that and can't believe how easy it is now... As easy as creating an HTML page!

So here is how it looks like now !
A lot better right!

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ywlhafme2nbgteujtp02.png)
 
Cheers
Need Guidance Regarding Migrating Existing Enterprise software to React JS
Tags: react, devops, webdev, migration
Published: 2022-07-22 05:24:00

We have a existing enterprise software which was build using jsp pages mainly, it has around 65 different web pages and approx. 15 modules like Admission, Time table, Fees Management, HR Management, Holidays, Exam, Quiz and many more such modules which has its own ecosystem.

We have to migrate the whole enterprise software to React JS.

We are not sure that our multipage application will work flowless in React.js as a single page application. Does it effects the performance of the application?

**Is it worth to build such a huge application in React JS?**