Leetcode - Third Maximum Number
Leetcode - Unique Email Addresses

Leetcode - Angle Between Hands of a Clock

violet posted @ Jul 15, 2020 01:29:39 AM in 算法 with tags Algorithm Golang math , 531 阅读

https://leetcode.com/problems/angle-between-hands-of-a-clock/

Given two numbers, hour and minutes. Return the smaller angle (in degrees) formed between the hour and the minute hand.

 

Example 1:

Input: hour = 12, minutes = 30
Output: 165

 

func angleClock(hour int, minutes int) float64 {
    hourDelta := (float64(minutes)/60)*30
    hourA := float64(hour)*30 + hourDelta
    minuteA := (float64(minutes)/60)*360
    if abs(minuteA - hourA) > 180 {
        if minuteA > hourA {
            return abs(minuteA - hourA - 360)
        } else {
            return abs(hourA - minuteA - 360)
        }
    }
    return abs(minuteA - hourA)
}

func abs(a float64) float64 {
    if a < 0 {
        return 0 - a
    }
    return a
}
BSNL Customer Care n 说:
Aug 10, 2022 01:37:39 AM

The new digital era based support system contributing a lion’s sharing related to all telecom services in 2021 calendar year, also find the new email address providing BSNL complaint process for payment failed issues for any digital payment service failure related issues like repayment, The new digital era based support system contributing a lion’s sharing related to all telecom services in 2021 calendar year, BSNL Customer Care number refund of debited amount and service activation /deactivation, complaints, tariff change requests.

SBT Online 说:
Nov 09, 2022 04:38:52 PM

SBT bank (State Bank of Travancore) was among Indian best and major banking facility established in 1945. The Bank’s headquartered in Thiruvananthapuram, Kerala. The State Bank of Travancore later merged with State bank of India SBI making a strong collaboration. The Bank offers different banking services to millions of customers in the country with over 15,000 branches. SBT Online SBI bank has five major associates, one being the state bank of Travancore.

reese 说:
Nov 29, 2022 07:27:26 PM

Leetcode is a website that offers a variety of coding challenges to solve. One challenge is to find the angle between the hands of a clock. The challenge is to consider all cbd effects possible angles, including those where the hands overlap. The website provides a few test cases to check your code against. Once you have a working solution, you can submit it to the site and see how it compares to other solutions.

JIO Switch 说:
Dec 19, 2022 07:55:52 PM

Jio Switch is created. A simple interface and the absence of advertisements are two positive aspects of the Jio application for India. However, the product does not include a cloud-based or on-premises alternative. JIO Switch JioSwitch, however, allows users to transfer or request large files with others and is quite simple to install and administer.

Emma 说:
Feb 05, 2023 03:34:07 PM

In this post, they have explained the Leetcode over here and which is for the angle between the hands of the clock. The corresponding code and the corresponding input and output real estate Waltham for the program are shared here. Such kinds of commands are really useful and I am looking here for more updates on that.

BSNL Wifi Plans Unli 说:
Feb 07, 2023 04:26:57 PM

ISP provides unlimited calls to any network round the clock in all the BSNL broadband plans over fiber and DSL networks, and Here we update the latest BSNL broadband unlimited plans daily across India as and when the update released for home and business tariff, BSNL Wifi Plans Unlimited for Home So check each plan in detail to opt for best tariff. BSNL broadband plans over DSL and Bharat Fiber (FTTH) technologies are available, we categorize each plan and provide the updated information of all the circles with new plans and tariff.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter