Classful addressing was deprecated more than 20 years ago. Subnetting is done in prefixes these days.
The prefix length is the number of bits at the start of the address that stay the same. Subnet mask 255.255.255.0 in binary is 11111111.11111111.11111111.00000000 correspond to prefix length 24 (count the 1s), 255.255.0.0 corresponds to 16 etc. For 300 hosts you need a network with prefix length 23Blues (or shorter): 23 bits fixed leaves 9 bits for numbering hosts, which gives you 512 addresses. The first and the last address are reserved, the rest you can use.
If we take 10.20.0.0/23 as example:
Network address and mask are:
00001010.00010100.00000000.00000000
11111111.11111111.11111110.00000000
We don't change the bits marked as fixed by the prefix. That gives us this range of addresses:
00001010.00010100.00000000.00000000
00001010.00010100.00000001.11111111
Which is 10.20.0.0 to 10.20.1.255. The first and last address are reserved for network and broadcast address, the rest (including 10.20.0.255 and 10.20.1.0) are normal addresses available to be used.