и посмотреть медиа
Golang LeetCode
и посмотреть медиа
Tareas de LeetCode en Golang. Soluciones con código y explicaciones.
Tareas de LeetCode en Golang. Soluciones con código y explicaciones.
bot de IA para clonar texto a voz y voz en Telegram. Cree audio utilizando la red neuronal de forma rápida y fácil.
Canal con soluciones para tareas populares de LeetCode en Go. Concéntrate en algoritmos optimizados, uso eficiente de memoria y código idiomático. Ayuda a preparar entrevistas técnicas en empresas que utilizan Golang.
Задача: 1344. Angle Between Hands of a Clock Сложность: medium Даны два числа, hour и minutes. Вернуть меньший угол (в градусах), образованный часовой и минутной стрелками. Ответы с точностью до 10^-5 от фактического значения будут считаться правильными. Пример: Input: hour = 12, minutes = 30 Output: 165 👨💻 Алгоритм: 1⃣Рассчитать углы: minutes_angle = 6 * minutes и hour_angle = (hour % 12 + minutes / 60) * 30. 2⃣Найти разницу: diff = abs(hour_angle - minutes_angle). 3⃣Вернуть меньший угол: min(diff, 360 - diff). 😎 Решение: package main import ( "math" ) func angleClock(hour int, minutes int) float64 { oneMinAngle := 6.0 oneHourAngle := 30.0 minutesAngle := oneMinAngle * float64(minutes) hourAngle := (float64(hour%12) + float64(minutes)/60.0) * oneHourAngle diff := math.Abs(hourAngle - minutesAngle) return math.Min(diff, 360 - diff) } Ставь 👍 и забирай 📚 Базу знаний
Открыть канал и посмотреть медиаSolo los usuarios registrados pueden compartir su opinión.
¡Sé el primero en compartir tu experiencia con este recurso!