ARTS Week 26

Algorithm

This week’s LeetCode problem is 215. Kth Largest Element in an Array

Given an integer array nums and an integer k, return the kth largest element in the array.

Note that it is the kth largest element in the sorted order, not the kth distinct element.

The kth largest element can be searched using the small top heap, and a small top heap with no more than K elements is maintained. Traverse the array, if the number of elements in the heap is less than K, add the array elements to the heap, and adjust the heap; if the number of elements in the heap is K, if the current element is greater than the for-element, remove the top element of the heap, and set the current Elements are added to the heap, and the heap is adjusted until the end of the array traversal.

Review

This week’s Review is for the following article: How to Start a Successful Freelance Business as a Software Developer

First of all, you need to figure out how much time you plan to devote to freelancing, whether it is a full-time job or a part-time job. When freelancing is your only source of income, this is a completely different concept than when you use it as additional income. Here are some suggestions from the author:

  • Forget Business Cards and a Portfolio Site. The first thing you need to do is how to increase awareness and build a personal brand, not a business card and a personal website so your customers can find you.
  • Networking Is the Most Important Thing You Can Do. You need to build your own social network so that you can find your potential customers more effectively.
  • Beware of Freelance Platforms, They Are Evil. If a platform surveils access to your personal information by violating your privacy, it’s not good for you or the customer, so say “no” to those.
  • Say ‘Hello World’ in Real Life. If you are in college, make more friends; go to local gatherings in related fields, and try to meet more collaborators at the gatherings; contact more local businesses and tell them that you can help.

Tip

In C language, the difference between r+, w+, a+ flags when opening a file:

  • r+: support both read and write; but open will fail when the file does not exist; fseek can be used to adjust read and write offsets
  • w+: supports both reading and writing; but when the file does not exist, it will create a file and then open it; fseek can only be used to adjust the read offset
  • a+: supports both reading and writing; but when the file does not exist, it will create a file and then open it; fseek can only be used to adjust the read offset, and only write when writing to the end of the file

Share

I have been on the road this week, without much thinking, the life in the future will gradually be on the right track, come step by step.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
KeepNewbie_yan

KeepNewbie_yan

5 Followers

A programmer. Share knowledge of programming, operating system, Linux kernel, and reading, thinking etc. Let us maintain a beginner mend and grow together!