Warren Buffett bought 31.2 million shares of Apple in the last three months of 2017 through Berkshire Hathaway and sold more than 94% of its shares in IBM.