Rotate Array

This is No.189 problem in LeetCode. The problem description is: Given an array, rotate the array to the right by k steps, where k is non-negative. Example 1: Input: [1,2,3,4,5,6,7] and k = 3 Output: [5,6,7,1,2,3,4] Explanation: rotate 1 steps to the right: [7,1,2,3,4,5,6] rotate 2 steps to the right: [6,7,1,2,3,4,5] rotate 3 steps to …

How to let WordPress only displays summary of article on home page

Firstly, find the directory: Appearance -> Theme Editor -> Main Index Template -> index.php, and locate the code: /* Start the Loop */ while ( have_posts() ) : the_post(); /* * Include the Post-Format-specific template for the content. * If you want to override this in a child theme, then include a file * called …

A Simple Calculator Application On Android Studio

1. Open Android Studio and create a new project. 2. Set the basic information and choose API. 3. Finish basic setting and choose activity platform (Basic Activity Here). 4. See the main page. 5. Remove some irrelevant code from activity_main.xml. Click the text button on the bottom of activity_main.xml. Delete FloatingActionButton which will show e-mail …

Dynamic Programming

What is Dynamic Programming? Let’s have a look at the definition on Introduction to Algorithm: "Dynamic programming like the divide-and-conquer method, solves problems by combining the solutions to sub-problems. Different from divide-and-conquer, dynamic programming applies when the sub-problems overlap — that is, when sub-problems share sub-sub-problems. A dynamic programming algorithm solves each sub-sub-problems just once …