卖萌的弱渣

I am stupid, I am hungry.

公司清单

公司主营业务

主营业务是什么,最近几年的销量和收入增速

行业分析

行业的产业链、产量、产能、竞争格局、供应和需求分析、行业发展阶段(不同行业分析的重点可能不同)。

比如行业的发展阶段若出于快速衰退和可以预见到被取代则pass,而行业停滞和缓慢衰退同时市场集中度不高的则也有投资价值(水泥行业)。

业务是否存在

这一点可重要可不重要,因为很多企业尤其是to C的企业基本不会有这个问题,而在看一家to B的企业时则需要关注这个点(很多港股的化工企业就有这个问题)。

实地调研、竞争对手、供应商、消费者、上市年份(超过10年的基本不会有问题)、借壳上市(有问题的可能性更大)。

财务数据是否真实

+有足够的货币资金,是否还有大量的短期和长期借款;

+商誉数额,形成的原因;

+经营性净现金流/归母净;

+毛利率、净利率异于同行的原因;

+存货、应收账款周转率是否异于行业;

+关联交易数额;

财务表现(本身以及同行业比较)

ROE、ROIC、十年资本支出效率

公司的核心竞争力(护城河)

需要与第5点一起看。

成本优势、品牌优势、技术优势、特许经营权

股权结构

很多公司为什么不具有先发优势、不具有天生优势、所在的行业也不是一个好生意,但是依然可以超越同行,为投资者带来丰厚的回报,原因是管理效率高,而根本的原因是股权结构。比如海螺水泥、洋河股份,他们的管理层和员工持股激发了人的活力。

我认为股权结构从好到不好的顺序是混合所有制、国资绝对控股、民营绝对控股。

利益相关者、企业文化、社会责任

看完基业长青这本书知道企业文化很重要,做正确的事,使企业更长久和健康的活下去,需要公司有正确的企业文化,但是这一点还是蛮难观察的,可能通过实地调研是更好的办法。

未来业务发展

价格和量上

会计报表

资产负债表

利润表

现金流量表

Play KVMGT (GPU Virtualization)

Host (Opensuse 14.2)

  • install libcheese

sudo apt-get install libglew-dev libcheese7 libcheese-gtk23 libclutter-gst-2.0-0 libcogl15 libclutter-gtk-1.0-0 libclutter-1.0-0

  • Download new host kernel
1
2
3
4
5
git clone https://github.com/01org/igvtg-kernel kernel_src
cd kernel_src
git checkout 2016q2-4.3.0 (linux kernel 4.3)
cp configure-file to ./.config
make ; make modules ; make modules_install ; make install; 

QEMU (2.3)

In ./configure, Add -lEGL when vgt-egl-compositor is used.

1
2
3
4
5
6
7
8
9
10
11
12
git clone https://github.com/01org/igvtg-qemu qemu_src
cd qemu_src
git submodule update --init dtc
git submodule update --init roms/seabios
./configure --prefix=/usr \
            --enable-kvm \
            --enable-sdl \
            --disable-werror \
            --target-list=x86_64-softmmu
make 
cd roms/seabios
LC_ALL=C make -j8

Host Grub

Add intel_iommu=igfx_off i915.hvm_boot_foreground=1 loglvl=all guest_loglvl=all conring_size=4M noreboot on linux option.

Host Driver

  • Update all packages including x11-xorg
1
2
3
4
5
6
7
git clone git://anongit.freedesktop.org/git/xorg/driver/xf86-video-intel
cd xf86-video-intel
git checkout 2.99.917
./autogen.sh --prefix=/opt/hsw/usr
make && make install
cd /usr/lib64/xorg/modules/drivers/
ln -sf /opt/hsw/usr/lib64/xorg/modules/drivers/intel_drv.so intel_drv.so

Guest

Partition Equal Subset Sum

Given a non-empty array containing only positive integers, find if the array can be partitioned into two subsets such that the sum of elements in both subsets is equal.

Note:

Both the array size and each of the array element will not exceed 100.

Example 1:

Input: [1, 5, 11, 5]

Output: true

Explanation: The array can be partitioned as [1, 5, 5] and [11].

Example 2:

Input: [1, 2, 3, 5]

Output: false

Explanation: The array cannot be partitioned into equal sum subsets.

Combination Sum 4

Given an integer array with all positive numbers and no duplicates, find the number of possible combinations that add up to a positive integer target.

Example:

nums = [1, 2, 3] target = 4

The possible combination ways are:

1
2
3
4
5
6
7
(1, 1, 1, 1)
(1, 1, 2)
(1, 2, 1)
(1, 3)
(2, 1, 1)
(2, 2)
(3, 1)

Note that different sequences are counted as different combinations.

Therefore the output is 7.

Follow up:

  • What if negative numbers are allowed in the given array?
  • How does it change the problem?

  • What limitation we need to add to the question to allow negative numbers?

Queue Reconstruction by Height

Suppose you have a random list of people standing in a queue. Each person is described by a pair of integers (h, k), where h is the height of the person and k is the number of people in front of this person who have a height greater than or equal to h. Write an algorithm to reconstruct the queue.

Note:

The number of people is less than 1,100.

Example:

Input:

[[7,0], [4,4], [7,1], [5,0], [6,1], [5,2]]

Output:

[[5,0], [7,0], [5,2], [6,1], [4,4], [7,1]]

Longest-Palindrome

Given a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those letters.

This is case sensitive, for example “Aa” is not considered a palindrome here.

Note:

Assume the length of given string will not exceed 1,010.

Example:

Input: “abccccdd”

Output: 7

Explanation: One longest palindrome that can be built is “dccaccd”, whose length is 7.

Wiggle Subsequence

A sequence of numbers is called a wiggle sequence if the differences between successive numbers strictly alternate between positive and negative. The first difference (if one exists) may be either positive or negative. A sequence with fewer than two elements is trivially a wiggle sequence.

For example, [1,7,4,9,2,5] is a wiggle sequence because the differences (6,-3,5,-7,3) are alternately positive and negative. In contrast, [1,4,7,2,5] and [1,7,4,5,5] are not wiggle sequences, the first because its first two differences are positive and the second because its last difference is zero.

Given a sequence of integers, return the length of the longest subsequence that is a wiggle sequence. A subsequence is obtained by deleting some number of elements (eventually, also zero) from the original sequence, leaving the remaining elements in their original order.

Examples:

1
2
3
4
5
6
7
8
9
10
Input: [1,7,4,9,2,5]
Output: 6
The entire sequence is a wiggle sequence.

Input: [1,17,5,10,13,15,10,5,16,8]
Output: 7
There are several subsequences that achieve this length. One is [1,17,10,13,10,16,8].

Input: [1,2,3,4,5,6,7,8,9]
Output: 2

Follow up:

Can you do it in O(n) time?

UTF-8 Validation

A character in UTF8 can be from 1 to 4 bytes long, subjected to the following rules:

  1. For 1-byte character, the first bit is a 0, followed by its unicode code.
  2. For n-bytes character, the first n-bits are all one’s, the n+1 bit is 0, followed by n-1 bytes with most significant 2 bits being 10.

This is how the UTF-8 encoding would work:

1
2
3
4
5
6
7
   Char. number range  |        UTF-8 octet sequence
      (hexadecimal)    |              (binary)
   --------------------+---------------------------------------------
   0000 0000-0000 007F | 0xxxxxxx
   0000 0080-0000 07FF | 110xxxxx 10xxxxxx
   0000 0800-0000 FFFF | 1110xxxx 10xxxxxx 10xxxxxx
   0001 0000-0010 FFFF | 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx

Given an array of integers representing the data, return whether it is a valid utf-8 encoding.

Note:

The input is an array of integers. Only the least significant 8 bits of each integer is used to store the data. This means each integer represents only 1 byte of data.

Example 1:

data = [197, 130, 1], which represents the octet sequence: 11000101 10000010 00000001.

Return true. It is a valid utf-8 encoding for a 2-bytes character followed by a 1-byte character.

Example 2:

data = [235, 140, 4], which represented the octet sequence: 11101011 10001100 00000100.

Return false. The first 3 bits are all one’s and the 4th bit is 0 means it is a 3-bytes character.

The next byte is a continuation byte which starts with 10 and that’s correct.

But the second continuation byte does not start with 10, so it is invalid.

Longest Substring With at Least K Repeating Characters

Find the length of the longest substring T of a given string (consists of lowercase letters only) such that every character in T appears no less than k times.

Example 1:

1
2
3
4
5
6
7
Input:
s = "aaabb", k = 3

Output:
3

The longest substring is "aaa", as 'a' is repeated 3 times.

Example 2:

1
2
3
4
5
6
7
Input:
s = "ababbc", k = 2

Output:
5

The longest substring is "ababb", as 'a' is repeated 2 times and 'b' is repeated 3 times.