Blog

Perl Weekly Challenge 104: FUSC Sequence

Write a script to generate first 50 members of FUSC Sequence. Please refer to OEIS for more information. The sequence defined as below: fusc(0) = 0 fusc(1) = 1 for n > 1: when n is even: fusc(n) = fusc(n / 2), when n is odd: fusc(n) = fusc((n-1)/2) + fusc((n+1)/2)

Perl Weekly Challenge 103: Chinese Zodiac

You are given a year $year. Write a script to determine the Chinese Zodiac for the given year $year. Please check out wikipage for more information about it. The animal cycle: Rat, Ox, Tiger, Rabbit, Dragon, Snake, Horse, Goat, Monkey, Rooster, Dog, Pig. The element cycle: Wood, Fire, Earth, Metal, Water.

Perl Weekly Challenge 102: Rare Numbers

You are given a positive integer $N. Write a script to generate all Rare numbers of size $N if exists. Please checkout the page for more information about it.

Perl Weekly Challenge 101: Origin-containing Triangle

You are given three points in the plane, as a list of six co-ordinates: A = (x1, y1), B = (x2, y2) and C = (x3, y3). Write a script to find out if the triangle formed by the given three co-ordinates contain origin (0, 0). Print 1 if found otherwise 0.

Perl Weekly Challenge 101: Pack a Spiral

You are given an array @A of items (integers say, but they can be anything). Your task is to pack that array into an MxN matrix spirally counterclockwise, as tightly as possible. ‘Tightly’ means the absolute value |M-N| of the difference has to be as small as possible.

Perl Weekly Challenge 100: Fun Time

You are given a time (12 hour / 24 hour). Write a script to convert the given time from 12 hour format to 24 hour format and vice versa. Ideally we expect a one-liner.

Loading…

Something went wrong. Please refresh the page and/or try again.


Follow My Blog

Get new content delivered directly to your inbox.